-
Notifications
You must be signed in to change notification settings - Fork 774
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
Baggage propagation is not possible for instrumentations without depending on OpenTelemetry.Api package #5667
Comments
Happy to contribute the change if there are no objections. |
Yes. A problem we've been facing from day1, thanks for looking into this!
Is the above proposal meant to short-term unblock libraries (like Azure SDK for example), to benefit from |
Since the problem in not going to be fixed in at least 1.5 years, I think workaround that does not introduce any public API and will disappear without the trace along with OTel propagators is quite reasonable. It's not going to solve p1, but it will:
The core part of the above proposal is to do I'm also fine not adding any support for |
@lmolkova FYI - This could run into some sequencing issues and may not work in all cases if set within Sdk. See https://github.com/open-telemetry/opentelemetry-dotnet/pull/3769/files#r1003730495. Overall I think this intermediate step will also be needed for supporting OTel Baggage with native instrumentation coming in .NET9.0. (Assuming we don't get baggage API in .NET) |
Good catch! This is not a new problem though. The
Not just baggage, but any non W3C context propagation - if users configured B3 on otel, native instrumentations need to be aware of this. As an alternative, OTel may make OTel propagators implement |
mm.. Not so sure given there is nothing taking care of in-proc propagation. The propagator API tweak can only fix part of the problem by propagating baggages set via both |
This is already broken even today. The proposed native instrumentation in .NET 9 is about populating attributes (tags). Asp.Net Core/HttpClient are already natively doing the context propagation part, and they don't respect OTel Propagators. (this is compensated for by our instrumentation libraries, by sometimes doing the extreme of throwing away the
This makes sense. OTel's propagators must deprecate itself, and fully embrace |
Sure, but it seems the baggage API and propagation are two independent concepts, right?
|
It seems we're in agreement that we need to use |
Yes💯! It was always the plan, but never had the bandwidth to make it happen. @vishweshbankwar did some exploration, and should be able to assist as well. I don't have strong preference over keeping OTel propagators as a thin wrapper around Anyway, these are details, and can be addressed in implementation phase. |
I'd be interested as to what came out of the discussion at the SIG, can someone detail that here? |
sure, the summary:
Assuming we can make things above work, there are no objections from going ahead with |
They are no longer part of .NET 9 :( |
Package
OpenTelemetry.Api
Package Version
Description
In Azure SDKs we want to be able to propagate baggage between messaging producer and consumer.
However there are two baggages:
System.Diagnostics.Acitivity.Baggage
- legacy(?) API that usesCorrelation-Context
header (by default via default implementation ofDistributedContextPropagator
)OpenTelemetry.Baggage.Current
- OTel baggage available inOpenTelemetry.Api
package.OTel discourages usage of
Activity.Baggage
:opentelemetry-dotnet/src/OpenTelemetry.Api/README.md
Line 107 in c38cc27
As a result:
OpenTelemetry.Api
- this is a showstopper for Azure SDK instrumentationsExpected Result
OTel and BCL should provide just one way to work with the baggage.
In the meantime, OTel can still provide consistent experience in the following way:
System.Diagnostics.DistributedContextPropagator
that does OTel-compatible baggage propagation: W3C +baggage
header. It also reads any context provided in theActivity.Baggage
(and never sets it)DistributedContextPropagator.Current
- at least as an opt-in mechanismHere's a PoC (tested for general happy case)
Configuration
As a result:
Baggage.Current
or viaActivity.Baggage
- both will end up inbaggage
header (or whatever is configured withSetDefaultTextMapPropagator
DistributedContextPropagator.Current
to propagate context - it will be consistent with one in theSdk.SetDefaultTextMapPropagator
Related issues:
DistributedContextPropagator
can be used to avoid injecting and extracting context in instrumentation libraries opentelemetry-dotnet-contrib#2013The text was updated successfully, but these errors were encountered: