Applying APM transaction labels to child spans

I'm currently setting transaction labels (e.g. user id and other transaction specific data) in my spring-boot based microservice, but that information doesn't get copied across to any subsequent child spans. Which means that when I view a collection of those child spans through Kibana I lose their context.

Ideally I'd like any labels I apply to a transaction to also be copied across to all child spans. Is this functionality already available in the APM agent?

At the moment I'm attempting to solve this problem with AspectJ, and trying to work out which methods in the agent I should be wrapping to detect when a new span has been created to allow me to set the labels on it. Unfortunately this is proving to be quite difficult.

Hi and welcome to our forum!

No, unfortunately it doesn't exist, nor it is planned.

I don't know how you aggregate and view spans, but maybe you can use spans' transaction.id field to extract the corresponding labels.

Unfortunately Kibana doesn't really support joins for visualisations, which is why I'm trying to amend the spans before they get sent off to the APM Server.

I'm also looking at ByteBuddy as a way to intercept calls to the current span when it's activated. I don't know if there are any recommended ways to do this.

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