# APM Java agent not capturing background running details and methods when enable sampling profiler

**URL:** <https://discuss.elastic.co/t/apm-java-agent-not-capturing-background-running-details-and-methods-when-enable-sampling-profiler/278531>\
**Category:** APM\
**Tags:** java\
**Created:** [July 13, 2021, 11:41am UTC](https://discuss.elastic.co/t/apm-java-agent-not-capturing-background-running-details-and-methods-when-enable-sampling-profiler/278531 "2021-07-13T11:41:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [July 13, 2021, 12:57pm UTC](https://discuss.elastic.co/t/apm-java-agent-not-capturing-background-running-details-and-methods-when-enable-sampling-profiler/278531/2 "2021-07-13T12:57:12Z")

</div>

If you are using a [supported scheduling framework](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html#supported-scheduling-frameworks), then maybe setting the [`application_packages`](https://www.elastic.co/guide/en/apm/agent/java/current/config-stacktrace.html#config-application-packages) is all you need to do.

Otherwise, you would need to manually trace those. One option is using the [`trace_methods`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-trace-methods) config option, but make sure to be very specific in what you set through it, don't cast a too-wide net. Another option is to manually trace the relevant methods through code, by using our [public API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html).

---

_[View the full topic](https://discuss.elastic.co/t/apm-java-agent-not-capturing-background-running-details-and-methods-when-enable-sampling-profiler/278531)._
