# APM Java JBoss - doubt related application\_packages

**URL:** <https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707>\
**Category:** APM\
**Tags:** java\
**Created:** [July 16, 2019, 10:22am UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707 "2019-07-16T10:22:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [July 16, 2019, 10:22am UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/1 "2019-07-16T10:22:05Z")

</div>

Hi,  
I'm using ELK 7.2 and I'm trying to use APM with Java agents to monitoring JBoss application. Currently it is working with this key:

> set JAVA\_OPTS=%JAVA\_OPTS% -Delastic.apm.application\_packages=ca.com.elastic

but I have no idea about it. I mean, is there a way to get the full list of used or available application\_packages? How _ca.com.elastic_ works? is there a way to see if anything is missing?

---

<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:** [July 16, 2019, 1:10pm UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/2 "2019-07-16T13:10:16Z")

</div>

Hi and thanks for your question 🙂

First of all, this setting is optional. The agent also works when you don't set it. The main thing that is does is that the agent can distinguish between application code and library code. That means that the UI can collapse the stack frames of library code and highlight the stack frames which are originated from your application. See also the [span timeline documentation](https://www.elastic.co/guide/en/kibana/current/spans.html).

Additionally, it allows the agent to be a bit more efficient on which classes to scan on startup so setting the value can increase startup performance.

The proper value of this setting depends on your project. Most Java projects have a root package. For example `com.myproject`. That would also be the appropriate value for this option. Note that you don't have to configure sub packages, just the root package.

Let me know if you found that information useful 🙂

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [July 16, 2019, 3:19pm UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/3 "2019-07-16T15:19:04Z")

</div>

Hi @felixbarny, thank you for the answer.  
Since I'm using APM to monitor JBoss application, it is not relevant my apm.application\_packages key, right?  
I mean, this key:

`set JAVA_OPTS=%JAVA_OPTS% -Delastic.apm.application_packages=ca.com.elastic`

could be omitted.  
furthermore, if I will not use it, APM agent will automatically scan every possible/found classes?

---

<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:** [July 16, 2019, 4:09pm UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/4 "2019-07-16T16:09:31Z")

</div>

> [@rschirin](#):
>
> Since I'm using APM to monitor JBoss application, it is not relevant my apm.application\_packages key, right?

It's still relevant. You probably don't want to monitor JBoss itself but rather your application which is deployed within JBoss. That web application most likely also has Java classes which are structured within some root package, right?

But yes, you can omit the setting and all classes will be scanned.

As mentioned, the startup may take a bit longer and the UI can't differ between application frames and library frames in order to collapse library stack frames by default.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [July 16, 2019, 4:43pm UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/5 "2019-07-16T16:43:06Z")

</div>

just the last doubt related to my last question: if I will not use application\_packages key, APM agent will collect every used Java classes (so also classes created by my own) or just the standard one?

---

<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:** [July 16, 2019, 5:31pm UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/6 "2019-07-16T17:31:37Z")

</div>

> [@rschirin](#):
>
> APM agent will collect every used Java classes

Could you clarify what you mean by “collect”?

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [July 17, 2019, 7:08am UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/7 "2019-07-17T07:08:01Z")

</div>

probably the correct phrase was "....APM agent will collect any transaction and data from whatever used Java classes, without any discrimination".  
If I have a Java class named `org.sport`, will it be detect automatically?

---

<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:** [July 17, 2019, 7:48am UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/8 "2019-07-17T07:48:45Z")

</div>

By default, the agent does not create spans for all method invocations. It rather instruments known interesting points in your application like incoming HTTP calls (so called transactions) and external calls to a database or to another HTTP service (so called spans).

With the [public API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html), you have the possibility to create additional spans. You can do that either programmatically or declaratively, via annotations.

Another option is to set the [`trace_methods`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-trace-methods) option which lets you define for which pattern of methods you want the agent to automatically create spans for. Be aware of the documented caveats though.

---

<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:** [August 7, 2019, 3:49am UTC](https://discuss.elastic.co/t/apm-java-jboss-doubt-related-application-packages/190707/9 "2019-08-07T03:49:00Z")

</div>

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