APM shared field name between RUM and Java agent

Hi,

We have implemented RUM in our React-based frontend and Java APM agents in the backend. We can see that the APM server in the "Service Map" makes correlations between the calls.

However, during the investigations, I cannot trace users' actions from the frontend through all backend services using the individual documents in the "Discover". I cannot find a single field which is shared between them. I see in the ECS docs that you have a session.id field, but it's never populated. I've looked at the transaction.id, trace.id and parent.id fields, but these are more or less unique.

How can the APM server show those correlations in the "Service Map", and how to replicate manually in the "Discover"? Also, is there a way to share fields like user.email or user.name between RUM and Java agents, so that each document from all affected services would show it?

Elastic Cloud version: 7.16.1, tier: Platinum
Rum-JS version: 5.12.0
Java Agent version: 1.32.0

Hi @gigaset,

Thanks for reaching out!

First of all, apologies for the delay.

However, during the investigations, I cannot trace users' actions from the frontend through all backend services using the individual documents in the "Discover". I cannot find a single field which is shared between them.

When you say "users' actions" do you mean user clicks?

Imagine the following scenario:

Setup:
Frontend side: RUM agent
Backend side: Java APM agent (for the demo I used a node.js backend btw)

  • user performs a click on a button.
  • the click triggers a network request to the backend service

As you mentioned, you should see the "Service Map" making the correlation. Something like this:

You can see the name of the service corresponding to my RUM agent (distributed-tracing-client-3) and the name of the service corresponding to my APM backend agent (distributed-tracing-node-js-3)

We can see this correlation on the APM UI waterfall, too:

  1. I have filtered out by "user-interaction" transactions type

  1. On the waterfall you can see the two services involved:
    • green lines belong to RUM agent
    • blue line belongs to APM backend agent

You can see the legend above the lines, where it says "Services"

If you click any of these 3 lines you will be able to see the field trace.id on the metadata information. The 3 of them will have the very same trace.id

If you want to see the events related to such trace.id via discover you could do what you can see in the screenshot above:

  1. Get the trace.id from the metadata info
  2. Filters docs by such trace.id

Make sure you have set the proper timeline otherwise you will not find the events you are looking for.

Let me know if this helps you.

Btw, and just in case I misunderstood, we don't support User Sessions. So, if you are looking for a unique id that groups all the actions triggered by a user in the lifespan of their session it's not yet possible OOTB. It's one of our top priorities. You could generate your own ID and attach it to all the transactions via addLabels.

--

Also, is there a way to share fields like user.email or user.name between RUM and Java agents, so that each document from all affected services would show it?

Both agents will behave separately, you would need to set the user context for the two agents:

If you want both agents to have the same user, you might need to send the frontend username/email via the request you perform to your servers and then set there the setUser dynamically

Thanks,
Alberto

Hi,

That is an excellent explanation. We already implemented the session.id in RUM using labels, and need to investigate sharing this field between the agents.

Thanks
Les

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.