Does the transation propagate from the server to the browser when loading a webpage?

Hello,

I'm trying to figure out if when the browser load a new page, so make an HTTP query to the server, if the transaction propagates from the server to the browser.

Currently I have setup-ed the RUM agent and the Java agent on an old fashioned webapp (almost load a page each time), and there is no distributed tracing between the client and the server.

Is it currently possible?

Thanks!

To better understand how this works and what's possible to achieve, follow through this nice blog post.

I have alread read this blog post. In the blog post the direction is always "Browser => Frontend => Backend..."

Should I understand that it is not possible?

@Nicolas_Labrot, take a look at the ElasticApm.ensureParentId method:

https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-ensure-parent-id

You will need to modify your application to use this method. Using it, the transaction created by the backend will generate IDs for the RUM agent to use, and then the transaction that the RUM agent creates will end up as the root of the trace.

Thank you axw for the link!

Can I create an improvment that would allow APM to take care of that automatically? (eg. by using a cookie) ?

@Nicolas_Labrot you're welcome to open a feature request. Since this would not be specific to one particular agent, please open it in https://github.com/elastic/apm. Please provide as much detail as you can about your use-cases and proposed solution.

(Regarding cookies: that sounds reasonable, but even if we were to provide an option to encode the IDs in a cookie, we would still need to make it configurable and opt-in, to avoid having dangling parent references.)

Thank you for your feedback, I will try to write something.

In my current context, kibana returns an empty "URL" (url.full) for the transaction coming from the JS agent (from the Java agent url.full is populated). Is there a way to populate the field?

This configuration is working, but "context" is not documented, it might be an hack:

    elasticApm.init({
       
        context: {
            "request": {
                "url": {
                    "full": window.location.href,
                },
                "method": "GET"
            }
        }
    });

Thank you for your help

Hi Nicolas,

In the RUM agent, We populate the URL information in the context.page for the page-load transaction. The structure would be

"context": {
    "page": {
      "referer": points to `document.referrer`,
      "url": points to `window.location.href`
    }       
}