-
Notifications
You must be signed in to change notification settings - Fork 731
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
Traceparent Header Propagation #3562
Comments
@KirolosShehata Could you please describe your expectation in more detail? Do you have two ASP.NET Core apps with one calling the other and you want the traceId to be propagated? Please check the remarks for
|
@utpilla I have two apps. First scenario:
The tracing of the two apps in this case is a expected (shown below) Second scenario:
The tracing of the two apps in this case is not as expected (shown below) However, My expectation is that disabling the AddHttpClientInstrumentation in App B (caller) will only result in: |
@KirolosShehata Could you please share a minimal repro app? |
@utpilla we created a sample repo for you. [@OmniaSalehSaad] The issue is that we might need to disable HttpClient in Project B. when we do so, the traceparent header is still automatically propagated but with a wrong ParentID value. |
@utpilla any updates? |
Can you give a minimal repro app, along with readme.md instruction to run it? |
@cijothomas thanks for the shared link. |
we discussed this in yesterday's community meeting as well, and what you see is the expected behavior.(agree its a bit awkward and not really desirable. See the details below)
Until the httpclient behaviour can be addressed, you need to enable HttpClient instrumentation (same for any library doing out of proc communication), to ensure correlation is done correctly. Let us know if this makes sense. |
@cijothomas thanks Cijo for your detailed reply. We have found a workaround for this which is to overwrite the "parent span id" part in the traceparent header with the span id of the actual last activity in Project B (in the cases that we are not using HTTP client instrumentation). In the meantime, I would like to know what you think about the proposed workaround and how we can implement it the best way (in a single location not after each leaf span). I thought about implementing the TextMapPropagator to a custom one and overwrite the parent span id in it, but I do not know how to set my propagator as the global one to be used automatically in all outgoing http calls. I tried: Sdk.SetDefaultTextMapPropagator(new TestMapPropagator()); but I think it's not working UPDATE: |
@cijothomas & @utpilla any updates around the issue mentioned above? |
OTel SDK never does context propagation. Its always done by libraries doing cross proc communication. (either the library natively does it, like HttpClient. Or the instrumentation library does it using Propagtors API.) |
Propagators are global in nature. i.e we have no ability to have a propagator for httpclient (doing the special propagation), and another propagator for another library. |
See my response above. Propagation is never done by the OTel SDK. It is always the responsibility of the libraries doing cross proc communication. |
@cijothomas I'm sorry to ping you in an old issue. I am on a quest to learn more about how I should go about doing header propagation for the correlation ID in ASP.NET Web API in .NET 7. Can you share a link to official Microsoft docs that talk about its automatic header propagation? Despite my best efforts, I cannot find anything. The best I have found is the Microsoft.AspNetCore.HeaderPropagation package, which still requires some manual set up. Thank you. |
I do not think its documented. |
@cijothomas , Sorry for messaging on a closed issue , but because there is context here i am messaging here . I have a couple of questions on the trace propagation using these instrumentation libraries which i am struggling to get in a sample asp net core app
Below is the startup
Below is the simple controller which redirects to another action
|
@sunildatla Please open a new issue describing the problem, so we can take a look. Please start with https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/examples/AspNetCore example app always, and modify it to show us the incorrect/unexpected behavior you are experiencing. That'll make it super easy to troubelshoot. Also correlation is automatically done for Logs. See doc : https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs/correlation |
Open Telemetry version: 1.0.0-rc9.3
.NET version: 6.0.7
I was trying different things using OTel in .NET and it worked as expected while having the AddHttpClientInstrumentation and AddAspNetCoreInstrumentation enabled. visualization was as below
but when i disabled the AddHttpClientInstrumentation from the caller , I found that the parent span ID isn't set right and therefore the visualization is not right.
same thing happens if i disable the AddAspNetCoreInstrumentation from the callee.
not sure if this is a bug in .NET OTel SDK or what but I think devs should have the option to not use the auto instrumentation
Another question is that I tried using "activity.SetParentId(parentSpanId); or Activity.Current.SetParentId(parentSpanId);"
but it's not overwriting the current value of the parent span id.
The text was updated successfully, but these errors were encountered: