Stacktrace configuration options
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes. The Elastic APM Java agent enables you to trace the execution of operations in your Java applications, sending performance metrics and errors to the Elastic APM Server. Availability This functionality is generally available and ready for production usage. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless Observability
Generally available
Stack
Generally available
APM Agent Java
Generally available
Used to determine whether a stack trace frame is an in-app frame or a library frame. This allows the APM app to collapse the stack frames of library code, and highlight the stack frames that originate from your application. Multiple root packages can be set as a comma-separated list; there’s no need to configure sub-packages. Because this setting helps determine which classes to scan on startup, setting this option can also improve startup time.
You must set this option in order to use the API annotations @CaptureTransaction and @CaptureSpan.
Example
Most Java projects have a root package, e.g. com.myproject. You can set the application package using Java system properties: -Delastic.apm.application_packages=com.myproject
If you are only interested in specific subpackages, you can separate them with commas: -Delastic.apm.application_packages=com.myproject.api,com.myproject.impl
the instrumentation aspect of this configuration option - specifying which classes to scan - only applies at startup of the agent and changing the value later won’t affect which classesgot scanned. The UI aspect, showing where stack frames can be collapsed, can be changed at any time.
| Default | Type | Dynamic |
|---|---|---|
<none> |
Collection | true |
| Java System Properties | Property file | Environment |
|---|---|---|
elastic.apm.application_packages |
application_packages |
ELASTIC_APM_APPLICATION_PACKAGES |
The Elastic APM Java agent enables you to trace the execution of operations in your Java applications, sending performance metrics and errors to the Elastic APM Server. Availability This functionality is generally available and ready for production usage. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
APM Agent Java
1.0+
Generally available since 1.0
Setting it to 0 will disable stack trace collection. Any positive integer value will be used as the maximum number of frames to collect. Setting it -1 means that all frames will be collected.
| Default | Type | Dynamic |
|---|---|---|
50 |
Integer | true |
| Java System Properties | Property file | Environment |
|---|---|---|
elastic.apm.stack_trace_limit |
stack_trace_limit |
ELASTIC_APM_STACK_TRACE_LIMIT |
While this is very helpful to find the exact place in your code that causes the span, collecting this stack trace does have some overhead. When setting this option to value 0ms, stack traces will be collected for all spans. Setting it to a positive value, e.g. 5ms, will limit stack trace collection to spans with durations equal to or longer than the given value, e.g. 5 milliseconds.
To disable stack trace collection for spans completely, set the value to -1ms.
Supports the duration suffixes ms, s and m. Example: 5ms.
| Default | Type | Dynamic |
|---|---|---|
5ms |
TimeDuration | true |
| Java System Properties | Property file | Environment |
|---|---|---|
elastic.apm.span_stack_trace_min_duration |
span_stack_trace_min_duration |
ELASTIC_APM_SPAN_STACK_TRACE_MIN_DURATION |