APM Java JBoss - doubt related application_packages

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?

Hi and thanks for your question :slight_smile:

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.

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 :slight_smile:

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?

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.

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?

Could you clarify what you mean by “collect”?

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?

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

1 Like

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