-
Notifications
You must be signed in to change notification settings - Fork 780
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
Unable to log baggages via a processor #2992
Comments
@cijothomas Sorry to ping direct but looks like the issue is resolved with |
@pseudonator Sort of a complicated situation you've run into! ASP.NET Core 5 and below didn't understand the W3C/OTel baggage header. It used a header called Correlation-Context. So
That is why in your processor you see empty baggage from the OTel API. Now as of ASP.NET Core 6 the framework understands baggage. That is why in your processor |
If OTel.Instrumentation.AspNetCore is used - then it should have worked in all versions. It does the job of extracting Baggage from "baggage" header. |
We have a desktop application running on .NET FX 4.7.2 where we would like to add
As of now we are focused on distributed tracing. |
Ran into the same problem. My enricher that is converting baggage to tags has to enumerate Activity.Baggage to successfully find the baggage. Does this mean that the documentation here is out of date or incorrect? Because it explicitly states that we should interact with Baggage via the Baggage API and not via the activity. |
The document is the correct usage of Baggage API, and it also includes an example enrichment from Baggage. https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/trace/extending-the-sdk/MyEnrichingProcessor.cs |
@cijothomas Here is a repro: https://github.com/paulbatum/opentelemetrysample Steps:
Its possible this app is doing something wrong, but the point is that at least in this example, the enricher that uses |
I just modified the existing example in this repo (https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/examples/AspNetCore/Controllers/WeatherForecastController.cs)
And made a request to it passing a header baggage with value as "foo=bar", and the activity added additional tag (foo with value as bar). Can you check the existing example app to see if it helps identify the issue in your app? |
The main difference that jumps out at me is that you're not doing this from a telemetry processor. In my sample, if I put code that checks Baggage.GetBaggage in the controller, it gets picked up. Its only missing from Baggage.GetBaggage when the processor attached to appB runs. Also, in my sample, the telemetry processor in app A does pick up the baggage ok, presumably because code explicitly set the baggage in the controller with Baggage.SetBaggage(..). So it seems like the issue is a combination of 1) having baggage get handled automatically by asp.net instrumentation and b) using said baggage from a telemetry processor. does the order of the last 3 lines of code here somehow matter?
|
@CodeBlanch We have a "lost Baggage" issue here due to https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs#L238 I am not able to recollect the reason behind clearing Baggage from ASP.NET Core Instrumentation, not from the SDKs Activity.OnEnd logic (after calling processors..) |
@paulbatum There is nothing wrong in your code or the Baggage API or the SDK. The misbehaving component is the Asp.Net Core instrumentation library. Will get back once we dig into this a bit more. |
I was just chatting with @vishweshbankwar about this. Figured I would post some thoughts here. Unclear to me this is an issue. In To say that another way, @paulbatum Have you tried to use the "Enrich" feature to access/process the baggage while the |
Just replying to myself, |
we should proceed to remove the cleanup of baggage in asp.net and asp.net core instrumentation libraries and that should take care of fixing this. |
Though this fix is in asp.net core, tagging for consideration in 1.5.0 of sdk timeline. |
I ran into the same issue that baggage cleanup. I am looking forward to the fix. |
@vishweshbankwar is working on this with the goal of fixing this in 1.5 |
Bug Report
List of packages below,
Runtime version: net6.0
Symptom
I'm trying to use a custom processor like the following to see the baggages that are being propagated. However in this processor
Baggage.Current
is not present to process the baggages.I inject the processor as the following in the downstream (destination) service.
However, I can see the baggages propagating if I log the baggage information in the controller of the downstream service but not the processor.
To Reproduce
Complete code can be found in the project.
It's a simple set of services,
Library
->Catalog
. Library (source service) calls the Catalog API (downstream service) with a set of baggages.To run the project, use
docker-compose -f docker-compose.yml -f docker-compose.override.yml up
To start propagating use curl,
curl -iv http://localhost:8002/api/Orders/books
The text was updated successfully, but these errors were encountered: