Open sl0thentr0py opened 3 months ago
@sl0thentr0py I am seeing this as well in my project. Im curious, are you seeing these inconsistencies and still able to effectively use distributed tracing across systems?
I am running into an issue where each new request to my BE from my FE / browser is causing these two methods below to return a very similar output as you see above:
sentry_trace = sentry_sdk.get_traceparent()
sentry_baggage = sentry_sdk.get_baggage()
// then print in a dict i get something like this:
{
'sentry_trace': '3311a76eb75844509d1e4406e3efc075-b9d29f60220bc5f0-1',
'baggage': 'sentry-trace_id=c867096f09a44c67892077b37d7cfd15,sentry-environment=development,sentry-release=777d725ed6de3660deaf1996ea88ceb847d21cfe,sentry-public_key=18a4b04ee1c04110abcb6302a134e3fa,sentry-transaction=/,sentry-sample_rate=1.0,sentry-sampled=true'
}
In my situation I have a my FE setup with sentry/browser
sdk, and my backend is with the django sdk. My app is SSR, so this is the flow I have:
meta
tags to my html template with the sentry-trace
and baggage
values (This works as intended, when i throw a FE error, the trace starts with my BE / initial server request, and then shows the FE transactions before error). tracePropagationTargets
as I am just testing as of now, which adds the sentry-trace
and baggage
headers (this also works as expected).sentry-trace
and baggage
headers are in the request header. The interesting thing, is when I log the get_traceparent
and get_baggage
values I see something very similar to you.
// headers on request:
sentry-trace: c867096f09a44c67892077b37d7cfd15-...-1
baggage: c867096f09a44c67892077b37d7cfd15-...-1, sentry-trace_id=c867096f09a44c67892077b37d7cfd15,sentry-environment=development ... (the rest)
//
sentry_sdk.get_traceparent(): 3311a76eb75844509d1e4406e3efc075-...-1
sentry_sdk.get_baggage(): sentry-trace_id=c867096f09a44c67892077b37d7cfd15, ... (the rest)
So you can see that the baggage sentry-trace_id is actually the correct one from the header that is being passed from the FE, but my django sentry setup is not using that trace and is rather starting a new one.
I may open my own issue, but I saw a similarity from your post to what I am seeing and wanted to see if this give you an idea of what could be wrong, and also is the distributed tracing is still working for you even though you have this inconsistency?
thx for the report @scott-schibli, I haven't gotten time to debug this at the moment but I'll keep you posted when I pick this up. There's definitely some sort of case we're not handling properly.
@sl0thentr0py Do you have any inclination to why distributed tracing isn't continuing the trace with the django sdk even when the sentry-trace
and baggage
headers are present? Documentation from the sentry/browser and django sdk says that distributed tracing for django system should work out of the box when these headers present.
In the meantime I will try to manually continue the trace in our middleware when the headers are present.
Version
incoming trace version - 2.11.0, outgoing trace version - unknown
Steps to Reproduce
https://sentry.sentry.io/api/0/projects/sentry/sentry/events/6122ec07d3694b7ba1aa88db962afde5/json/
trace_id
s on the two headers are differentsentry-trace
is sampled but thebaggage
is not