elastic / elastic/apm

Automatically propagate the transaction from the server to the browser when loading a page

Open
#134 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Gherkin
Stars
427
Forks
125
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

The correlation between the transaction initiated by the backend with the spans of the JavaScript Real User Monitoring (RUM) agent requires [to manually modify the backend and the frontend](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-ensure-parent-id).

**Describe the solution you'd like**
The objective is to not modify the backend nor the frontend.

It could be achieve by:

1. Dynamically updating the HTML (like dynatrace)
2. Using a cookie.

1\. might be not straightforward. 2. might be easier.

The workflow could be the following.

The backend agent:
- Detects that the response is of type "html"
- Detects that the request is not already instrumented by the JS (async request)
- Encodes the `traceId`, the `spanId` and `sampled` into a cookie.

The JS frontend agent:
- Detects the cookie, decodes the values
- Initializes the `pageLoad*`
- Deletes the cookie.

Does it make sense?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.