apm-agent-rum-js
apm-agent-rum-js copied to clipboard
Expose API to get/set tracing headers for custom transactions
- When users create custom transactions and instrument XHR calls manually instead of the managed transactions, we would need to expose this method https://github.com/elastic/apm-agent-rum-js/blob/fa9cd92c01dd86f01c5230ddc1ac86e1da2d13ae/packages/rum-core/src/performance-monitoring/performance-monitoring.js#L339-L346 which sets the trace headers to the current outgoing request (fetch/xhr).
More details
- https://discuss.elastic.co/t/distributed-tracing-question-about-how-to-implement/204734/4
- https://discuss.elastic.co/t/custom-transactions-cannot-match-the-trace-id-of-the-backend/223278/3
In the interests of transparency, we’ve discussed this in refinement and we won’t be able to work on this or plan it in right now, whilst the team are focusing on Synthetics.
What's the status of this two years later? I'm looking for a way to manually pass traceparent
as header of a frontend->server request within a custom transaction.
Taking inspiration from here and from the traceparent
values I was getting with auto-instrumentation, I successfully tested manually setting the traceparent
to 00-${span.traceId}-${span.id}-01
, with "00" and "01" being the unknown (to me) "version" and "tag" respectively.
Will we get an exposed function to get the right value from the transaction/span?
@vigneshshanmugam Any chance you can share any updates on this?
This is an important feature for us!
Since we're forced to use custom transactions to capture concurrent traces, it's the only way to have distributed tracing.