Replies: 1 comment
-
dropping this just in case it provides any help: https://github.com/microsoft/ApplicationInsights-Java/blob/main/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/InheritedAttributesSpanProcessor.java |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context: I have a single application 'serviceA' (say Spring-boot based) that is instrumented with OTel java and a custom extension. The custom extension has some custom configuration logic along with custom span processors/samplers.
Question: Within serviceA, I would like to propagate the root span attributes or name to all child spans. I currently determine if a span is root based on certain spanKind and spanAttribute values. For example, if the root span name is
foobar
, I would like to each child span to have an span attribute namedroot.span.name=foobar
.To go about doing this, I played around with setting and reading from Baggage in a span processor
onStart
method. I also experimented with setting values into Baggage in a sampler'sshouldSample
method and reading Baggage in span processoronStart
method. In either cases, this does not appear to be working correctly.After reading through github issues and OTel slack threads, having an extension set data into the Baggage is not a pattern as Baggage (and Context) is immutable. Is this correct assumption? Additionally, examples that I have seen seem to indicate Baggage can only be set in the instrumented application side. For example:
(Taken from Honeycomb's docs but the idea is more or less the same).
You could then have a span processor to read from Baggage and set span attributes.
I currently store the root span name in a cache keyed by the trace ID. This is problematic and not ideal.
I'd love to hear the community's thoughts! Thank you.
Beta Was this translation helpful? Give feedback.
All reactions