# Default tags/labels on configuration

**URL:** <https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406>\
**Category:** APM\
**Created:** [March 21, 2019, 9:45pm UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406 "2019-03-21T21:45:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredgalvao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredgalvao/32/42048_2.png) [@fredgalvao](https://discuss.elastic.co/u/fredgalvao)\
**Post date:** [March 21, 2019, 9:45pm UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/1 "2019-03-21T21:45:21Z")

</div>

**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?

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [March 22, 2019, 1:33am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/2 "2019-03-22T01:33:29Z")

</div>

Hi @fredgalvao,

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

Cheers,  
Andrew

---

<div class="post-metadata">

**Author:** ![fredgalvao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredgalvao/32/42048_2.png) [@fredgalvao](https://discuss.elastic.co/u/fredgalvao)\
**Post date:** [March 22, 2019, 2:09am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/3 "2019-03-22T02:09:42Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [March 22, 2019, 1:55pm UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/4 "2019-03-22T13:55:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [March 23, 2019, 10:24am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/5 "2019-03-23T10:24:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fredgalvao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredgalvao/32/42048_2.png) [@fredgalvao](https://discuss.elastic.co/u/fredgalvao)\
**Post date:** [March 23, 2019, 10:32pm UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/6 "2019-03-23T22:32:16Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [March 24, 2019, 7:05am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/7 "2019-03-24T07:05:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fredgalvao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredgalvao/32/42048_2.png) [@fredgalvao](https://discuss.elastic.co/u/fredgalvao)\
**Post date:** [March 26, 2019, 1:41am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/8 "2019-03-26T01:41:36Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [March 26, 2019, 7:13am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/9 "2019-03-26T07:13:54Z")

</div>

> [@fredgalvao](#):
>
> I was actually more interested in the possibility of supplying configuration through the programmatic self-attach API

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.

```auto
       <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>

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2019, 3:13am UTC](https://discuss.elastic.co/t/default-tags-labels-on-configuration/173406/10 "2019-04-16T03:13:59Z")

</div>

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