# How to add label in Java apm agent

**URL:** <https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540>\
**Category:** APM\
**Tags:** java\
**Created:** [December 4, 2019, 1:31pm UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540 "2019-12-04T13:31:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rijash](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rijash](https://discuss.elastic.co/u/rijash)\
**Post date:** [December 4, 2019, 1:31pm UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540/1 "2019-12-04T13:31:35Z")

</div>

**Kibana version** : 7.4

**Elasticsearch version** : 7.4

**APM Server version** : 7.4

**APM Agent language and version** : java 1.9.0

Hi,

Could you guide to add "label" in java APM agent.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 4, 2019, 1:40pm UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540/2 "2019-12-04T13:40:43Z")

</div>

Hi @rijash,

You can use the [global\_labels](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-global-labels) configuration option to set labels that will be added to all events, transactions and errors that are created by the agent.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 4, 2019, 2:11pm UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540/3 "2019-12-04T14:11:46Z")

</div>

Alternatively, you could also use API to add dynamic tags at runtime by using [Span.addTag(...)](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-span-add-tag) method.

---

<div class="post-metadata">

**Author:** ![rijash](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rijash](https://discuss.elastic.co/u/rijash)\
**Post date:** [December 6, 2019, 7:03am UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540/4 "2019-12-06T07:03:15Z")

</div>

Thanks Sylbain,

I am able to add the label using "global\_labels". But i want the value for the label to be hyperlink.

So, that when i will click the value it will open a different page.

Could you please help me to make the value as hyperlink enabled.

Thanks.

Regards,  
Rijash

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 6, 2019, 1:36pm UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540/5 "2019-12-06T13:36:32Z")

</div>

I am not really sure to understand what do you mean by hyperlink here:  
do you want to:

- provide a tag which value is an URL like `https://discuss.elastic.co/` which Kibana should wrap in `<a>` HTML tag to make it clickable ?
- provide a tag value that can be used in Kibana to filter items that have the same tag by just clicking it

The first one is not supported for security as it would allow anyone with access to the application code to inject arbitrary links into Kibana UI.

---

<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:** [December 27, 2019, 9:36am UTC](https://discuss.elastic.co/t/how-to-add-label-in-java-apm-agent/210540/6 "2019-12-27T09:36:38Z")

</div>

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