yaaaaale
01/31/2024, 9:42 PMSentry-Trace on every single XHR request (including ones to Medplum).
We saw that there are docs showing that Medplum supports an X-Trace-Id header. Is it possible for Medplum to check for a Sentry-Trace header and use that as the trace ID? That would give Medplum support for Sentry's distributed tracing out-of-the-box, which would be pretty rad.
Otherwise, we'll have to do some extra work to grab the sentry trace ID and add that to medplum requests as an X-Trace-Id header. Definitely doable, but a bit of a pain.yaaaaale
01/31/2024, 10:46 PMSentry-Trace is actually a traceparent value, e.g.: 79078f4ef8da4c7982c61184b7e20f94-89d3679edd366475-1node
02/02/2024, 12:20 AMX-Trace-Id were set to the Sentry-Trace value by the client, the Medplum server would currently ignore it because it is not a UUID.
https://github.com/medplum/medplum/blob/f86debc144a6bb73169bec8b0bf12bebaadeb6b0/packages/server/src/context.ts#L106
https://github.com/getsentry/sentry-javascript/blob/6dfddc2dfc4b74cbb70dc325b4af165e25904ed4/packages/utils/src/tracing.ts#L117-L130
I've opened this PR to have the Medplum server directly support the Sentry-Trace header https://github.com/medplum/medplum/pull/3877rahul1
02/02/2024, 1:04 AMrahul1
02/02/2024, 1:06 AMtraceparent validation to be inline with the spec: https://luizlelis.com/blog/tracecontext#:~:text=The%20traceparent%20field&text=version%20(8%2Dbit)%3A%20trace,trace%20globally%20through%20a%20system.rahul1
02/02/2024, 1:14 AMnode
02/02/2024, 1:28 AMtraceparent spec unblocks distributed tracing for at least Sentry, though it would require additional client configuration.rahul1
02/02/2024, 1:33 AM00.
There might be a middle ground here where we can consider those optional when we parse the traceparent header