Default tags/labels on configuration

Kibana version:
6.6.1
Elasticsearch version:
6.6.1
APM Server version:
6.6.1
APM Agent language and version:
java-agent-1.4.0

Issue/Question

Is there a way or plan for it to be possible to add default tags/labels to the transaction instrumentation on java (or any other language, I guess)?

For example, I'm setting up APM for a whole universe of environments, host machines, groups of running services, and each group is semantically separated from each other by name (and sometimes even contract type, data visibility, etc). I'll have a single global elastic cluster to receive all APM/beat data from all of those groups/services, but I'd like to separate them accordingly when needed (infrastructure between them vary a lot, and it'd be unfair to compare all instances of a service performance-wise).

So, what I thought was adding manually a tag/label indicating the ecosystem (it's the name we use for a group of services/customers/hosts in the same infrastructure) that service is running in. I know I can do it for each transaction/request, but it'd be idea if I could inform these default tags/labels during setup/attach time, so that all transactions/instrumentation could automatically reuse them on that agent lifecycle.

I'm sure this would come in handy for a lot of use cases where such tags/labels were to be set per-request on a multi-servlet-one-container environment too.

Is this already possible somehow? Would it be a welcome change to the API?

Hi @fredgalvao,

Thanks for raising the question! I think https://github.com/elastic/apm/issues/48 would address your requirements. Did I understand you correctly?

Cheers,
Andrew

You did understand it perfectly. I was naive to think this would be something new or local to java agents, and didn't think better to look for it in the apm repo or in the other agents.
There's even an issue for the java one specifically: https://github.com/elastic/apm-agent-java/issues/507

I'll make sure to follow them closely, and I'm looking forward to them being available!
Thanks for your time, @axw.

1 Like

Implemented via https://github.com/elastic/apm-agent-java/pull/543 but it needs some changes in the APM Server.

1 Like

In the mean time, you can use this option https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-environment and just concatenate all the environment identifiers.

Thanks for the tip, @felixbarny! I'm afraid of waiting for the next java-agent version, because I'm seeing it'll cascade into waiting for the next apm-server version, which will only come with ES7.0 (which I don't know when will reach GA).

I’m afraid it’s already too late to I introduce new features in 7.0, so 7.1 would be more likely. Is the workaround via environment good enough for you in the mean time?

I'll manage without the default labels. I was actually more interested in the possibility of supplying configuration through the programmatic self-attach API (another topic I created). But anyway, I can manage without it for now.
Thanks for your time!

That will be released soon. In the mean time, you can try out the snapshot from the sonatype snapshot repo. The Maven equivalent would be adding this repository, not sure about grails though.

       <repository>
         <id>snapshots-repo</id>
         <url>https://oss.sonatype.org/content/repositories/snapshots</url>
         <releases><enabled>false</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
       </repository>
1 Like

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