# Customizes fields send by the APM

**URL:** <https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508>\
**Category:** APM\
**Created:** [March 8, 2019, 2:07pm UTC](https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508 "2019-03-08T14:07:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustapha\_HAJ\_ROMDHA1](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Mustapha\_HAJ\_ROMDHA1](https://discuss.elastic.co/u/Mustapha_HAJ_ROMDHA1)\
**Post date:** [March 8, 2019, 2:07pm UTC](https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508/1 "2019-03-08T14:07:52Z")

</div>

Hello,

I'm trying to add fields about the thread to the default fields sent by the APM.

I want to know is it possible or not, if so how to do it ?

Thank you

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [March 11, 2019, 6:12am UTC](https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508/2 "2019-03-11T06:12:26Z")

</div>

Hi,

Which agent do you use? In the Java agent it is possible to add any data using addTag: [https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-transaction-add-tag](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-transaction-add-tag)

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![Mustapha\_HAJ\_ROMDHA1](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Mustapha\_HAJ\_ROMDHA1](https://discuss.elastic.co/u/Mustapha_HAJ_ROMDHA1)\
**Post date:** [March 11, 2019, 8:28am UTC](https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508/3 "2019-03-11T08:28:19Z")

</div>

Thank you for your answer Wolfram,  
At the moment i am trying to collect data about threads launched by an application deployed on jboss, do you have an idea how to proceed ?

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [March 11, 2019, 8:34am UTC](https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508/4 "2019-03-11T08:34:10Z")

</div>

The only way I know is:

1. Include the apm-agent-api dependency to your application : [https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api/1.4.0](https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api/1.4.0)
2. In your code access the current transaction: [https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-current-transaction](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-current-transaction)
3. Add your custom fields: [https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-transaction-add-tag](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-transaction-add-tag)

This might look like: ElasticApm.currentTransaction().addTag("isDaemon", Boolean.toString(Thread.currentThread().isDaemon()));

Hope this helps...

---

<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 1, 2019, 4:41am UTC](https://discuss.elastic.co/t/customizes-fields-send-by-the-apm/171508/5 "2019-04-01T04:41:33Z")

</div>

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