-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POC] Make scope attributes as identifying for Tracer, Meter, Logger #5806
base: main
Are you sure you want to change the base?
Conversation
… identifying for Tracer, Meter, Logger
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5806 +/- ##
=====================================
Coverage 84.6% 84.6%
=====================================
Files 272 272
Lines 22839 22858 +19
=====================================
+ Hits 19325 19344 +19
Misses 3170 3170
Partials 344 344 |
@open-telemetry/go-maintainers, can you make a rough review if it looks like a good way to implement open-telemetry/opentelemetry-specification#4161? This PR is done in a PoC manner and it lacks unit tests - I just added few more assertions to validate the implementation. I plan to make open-telemetry/opentelemetry-specification#4161 as "ready to merge" tomorrow. |
This looks in line with our prior attempt: #3131 |
Looks reasonable to me. Prometheus exporter is only supposed to add those attributes to the otel_scope_info metric, btw. |
I think this is what I described. If not then please update my description 😉 |
This look nice. Does it impact the benchmarks for tracer/meter/logger retrieval? |
@@ -183,7 +183,7 @@ func getJSON(now *time.Time) string { | |||
timestamps = "\"Timestamp\":" + string(serializedNow) + ",\"ObservedTimestamp\":" + string(serializedNow) + "," | |||
} | |||
|
|||
return "{" + timestamps + "\"Severity\":9,\"SeverityText\":\"INFO\",\"Body\":{\"Type\":\"String\",\"Value\":\"test\"},\"Attributes\":[{\"Key\":\"key\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key2\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key3\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key4\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key5\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"bool\",\"Value\":{\"Type\":\"Bool\",\"Value\":true}}],\"TraceID\":\"0102030405060708090a0b0c0d0e0f10\",\"SpanID\":\"0102030405060708\",\"TraceFlags\":\"01\",\"Resource\":[{\"Key\":\"foo\",\"Value\":{\"Type\":\"STRING\",\"Value\":\"bar\"}}],\"Scope\":{\"Name\":\"name\",\"Version\":\"version\",\"SchemaURL\":\"https://example.com/custom-schema\"},\"DroppedAttributes\":10}\n" | |||
return "{" + timestamps + "\"Severity\":9,\"SeverityText\":\"INFO\",\"Body\":{\"Type\":\"String\",\"Value\":\"test\"},\"Attributes\":[{\"Key\":\"key\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key2\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key3\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key4\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"key5\",\"Value\":{\"Type\":\"String\",\"Value\":\"value\"}},{\"Key\":\"bool\",\"Value\":{\"Type\":\"Bool\",\"Value\":true}}],\"TraceID\":\"0102030405060708090a0b0c0d0e0f10\",\"SpanID\":\"0102030405060708\",\"TraceFlags\":\"01\",\"Resource\":[{\"Key\":\"foo\",\"Value\":{\"Type\":\"STRING\",\"Value\":\"bar\"}}],\"Scope\":{\"Name\":\"name\",\"Version\":\"version\",\"SchemaURL\":\"https://example.com/custom-schema\",\"Attributes\":{}},\"DroppedAttributes\":10}\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we populate values to attributes to make sure the output actually has a value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Leaving this open to not forget about it when I will be working on actual implementation.
It does (because there is a bigger memory footprint) but IMO not significantly. E.g.
|
Spike for open-telemetry/opentelemetry-specification#4161 (and #3368)
API changes:
Attributes attribute.Set
field toinstrumentation.Scope
,logtest.ScopeRecords
Behavioral changes:
Tracer
,Meter
,Logger
returned by the providers now handle scope attribute; the value is assigned by the SDK and it is seen as one of the identifying fieldsotel_scope_info
metric.Remarks:
Zipkin exporter DOES NOT set the instrumentation scope attributes as it is not required by the spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md. This may be a bug or missing feature in the spec.