-
Notifications
You must be signed in to change notification settings - Fork 486
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
feat(tracing): inject component ID as instrumentation scope attribute #5286
feat(tracing): inject component ID as instrumentation scope attribute #5286
Conversation
ae08353
to
d0de674
Compare
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.
No docs changes included, so I'll step away from this one :-)
I'm testing this change locally right now, and I'm trying to figure out where the attributes show up in Tempo. |
I'm not able to see the instrumentation scope in Tempo; trying to figure out why. |
I chatted with the Tempo team and apparently Tempo doesn't support instrumentation scope attributes yet, so setting this would be a no-op for Tempo. For now, we have to decide if this attribute belongs more on the span or on the resource (which Tempo would support today). WDYT @ptodev @hainenber? |
I suppose a span attribute would be more appropriate. As defined in the spec, a "resource" is supposed to combine multiple instrumentation scopes. Hence it doesn't seem appropriate to assume that only one instrumentation scope is part of the resource. I think we should proceed like this:
In the long run, after Tempo supports instrumentation scope, we could even optimise by deprecating the BTW I wonder whether we should use the source code attribute conventions as well. I cannot think of a clean way to use it. We could have |
hi there, long week for me, hence the long time for reply :) First of all, thanks @rfratto for going to extended length to reach out Tempo team to test it out. That was awesome! Basically, I agree with @ptodev's proposal here. We can keep the span attribute as is and try to add instrumentation scope without the component's instance name (I suppose that means we need to omit the last dot-separated part, e.g. "a.b.c" -> "a.b") Although Tempo might not support instrumentation scope attribute, other OTEL-compatible tracing backend might already support it and so it could be more than just no-op ;) Let me implement and test the proposal. Will keep you posted |
d0de674
to
dc237d6
Compare
Signed-off-by: hainenber <[email protected]>
dc237d6
to
6f30a7d
Compare
Hi folks, I've made a draft implementation as suggested above. PTAL when you have time. Thanks! |
// Inject the component name as instrumentation scope attribute. | ||
// This would not have component's exact ID, aligning with OTEL's definition | ||
if wp.id != "" { | ||
otelComponentName := strings.TrimSuffix(wp.id, filepath.Ext(wp.id)) | ||
options = append(options, trace.WithInstrumentationAttributes(attribute.String(wp.spanName, otelComponentName))) | ||
} |
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.
Does the exact ID of the component still get set on the span?
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.
Yes, the old function isn't removed, yet ;)
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.
Cool, just double checking :)
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.
Thanks for your work!
PR Description
Which issue(s) this PR fixes
Fixes #5285
Notes to the Reviewer
PR Checklist