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

Provide API for manual Context management

Open mshustov opened this issue 3 years ago • 1 comments

Hi, I'm from the Kibana team, and I'm working on APM RUM agent integration into Kibana. In the Kibana use case, when a user opens a dashboard page, Kibana might render several visualizations. Each visualization triggers an async sequence of steps that ends up in a network request to fetch data. We found out the APM RUM agent doesn't support context propagation when multiple async operations are executed in parallel. So we have to work around this limitation by implementing a custom solution for manual context propagation. It would be awesome if the APM RUM agent provides API for manual Context management.

// in dashboard code
const context = apm.createContext({ type, id }); // just for a demo purposes
await initDataLoading({ context });
// in http service
apm.startTransaction(...);
apm.bind(context);
await fetch(...) // automatically propagates context via headers

mshustov avatar Jun 16 '21 08:06 mshustov

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