elastic / apm-agent-rum-js

https://www.elastic.co/guide/en/apm/agent/rum-js/current/index.html
MIT License
279 stars 135 forks source link

Spans should have complete trace context #307

Open hmdhk opened 5 years ago

hmdhk commented 5 years ago

In some case in our code we don't set all of the trace context information (sampled, parentId, traceId) on spans (e.g. on resource timings). Although we fix the payload we send to the APM server with correct trace context information, this still might be a problem if users try to access this information. An example of use-cases might be to include trace context in the logs or transfer the trace context to another application.

We should do a review of the code to make sure the trace context exists on all spans we create and possibly add tests to avoid having incomplete trace context in the spans.

sorenlouv commented 3 years ago

Fyi: this is required for https://github.com/elastic/kibana/issues/88527.

vigneshshanmugam commented 3 years ago

@sqren What is the exact information we are missing here, This issue is for users that are trying to retrive these info locally from spans through JS code. We already process and send the correct traceId, parentId, sampled flags to the APM server, so APM UI would have these data at any given time.

The APM UI dependencies issue is due to tracestate header if i remember correctly from our internal conversation.

sorenlouv commented 3 years ago

@ogupte do you have more context?