apm-agent-rum-js icon indicating copy to clipboard operation
apm-agent-rum-js copied to clipboard

Expose API to get/set tracing headers for custom transactions

Open vigneshshanmugam opened this issue 5 years ago • 7 comments

  • 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

vigneshshanmugam avatar Oct 25 '19 09:10 vigneshshanmugam

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.

paulb-elastic avatar Jun 22 '21 18:06 paulb-elastic

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.

sebastiendan avatar Aug 23 '23 11:08 sebastiendan

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?

sebastiendan avatar Aug 23 '23 12:08 sebastiendan

@vigneshshanmugam Any chance you can share any updates on this?

sebastiendan avatar Sep 09 '23 10:09 sebastiendan

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.

axelv avatar Jan 30 '24 07:01 axelv