opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Optionally add baggage to span attributes

Open adamleantech opened this issue 2 years ago • 7 comments

resolves #4520

adamleantech avatar Mar 10 '23 10:03 adamleantech

Did you consider using a SpanProcessor for this?

laurit avatar Mar 10 '23 20:03 laurit

@laurit good suggestion, I wasn't aware of that

adamleantech avatar Mar 15 '23 15:03 adamleantech

@laurit updated PR as per your suggestion. I've realised that there is probably an issue with my previous PR for logback MDC in that the "baggage." prefix should be on the key not the value

adamleantech avatar Mar 16 '23 12:03 adamleantech

@adamleantech thanks for reporting, I'll fix it

laurit avatar Mar 16 '23 13:03 laurit

I wonder if otel.javaagent.span.add-baggage should take a list of baggage to add (or * for all), this would match otel.instrumentation.logback-appender.experimental.capture-mdc-attributes

and maybe we should do the same for otel.instrumentation.logback-mdc.add-baggage?

trask avatar Apr 13 '23 14:04 trask

I'm interested in this same functionality but for use as an AutoConfigureSpi addition to a manually instrumented program (which uses the AutoConfigure SDK extension).

Is there anything which ties AgentTracerProviderConfigurer to the java agent (other than the name?).

Not for this PR obviously, but I wonder if this and AddThreadDetailsSpanProcessor could be relocated into the https://github.com/open-telemetry/opentelemetry-java repo as some sort of sdk-extension-customizer artifact?

evantorrie avatar Apr 28 '23 07:04 evantorrie

Is there anything which ties AgentTracerProviderConfigurer to the java agent (other than the name?).

Yeah, this configurer is coupled to the agent through the AgentConfig as well...but I think there's room for that to be a separate responsibility (separate PR).

Not for this PR obviously, but I wonder if this and AddThreadDetailsSpanProcessor could be relocated into the https://github.com/open-telemetry/opentelemetry-java repo as some sort of sdk-extension-customizer artifact?

I am liking this idea. @jack-berg and @jkwatson what do you think? Is there room for add-on processors like this in the core repo, or would you prefer to see it as a contrib addition, or something else?

breedx-splk avatar Jul 10 '23 20:07 breedx-splk

Contrib is the appropriate place for this. If such a processor were to occur in the spec, we could promote that component the core repo.

jack-berg avatar Jul 10 '23 21:07 jack-berg

Has this been contributed to the contrib repo / exists on the java agent?

galbash avatar Nov 19 '23 11:11 galbash

Has this been contributed to the contrib repo / exists on the java agent?

not yet

trask avatar Nov 28 '23 02:11 trask