Configuration
To adapt the Elastic APM Java agent to your needs, you can configure it using one of the methods below, listed in descending order of precedence:
-
- Properties file
The
elasticapm.properties
file is located in the same folder as the agent jar, or provided through theconfig_file
option.
-
- Java system properties
All configuration keys are prefixed with
elastic.apm.
-
- Environment variables
All configuration keys are in uppercase and prefixed with
ELASTIC_APM_
.
-
- Runtime attach parameters
-
--config
parameter.
See Automatic setup withapm-agent-attach-cli.jar
.
- Arguments of
ElasticApmAttacher.attach(...)
.
See Programmatic API setup to self-attach. elasticapm.properties
in classpath root withElasticApmAttacher.attach()
.
See Programmatic API setup to self-attach.
-
- Default values
- Defined for each configuration.
Configuration options marked with Dynamic true can be changed at runtime when set from supported sources:
- Central configuration
elasticapm.properties
file- Java system properties, but only when set from within the application
There are two distinct ways to use elasticapm.properties
: as an external configuration file, and as a classpath resource.
Only the external file can be used for dynamic configuration.
In order to get started with Elastic APM, the most important configuration options are service_name
, server_url
and application_packages
. Note that even these settings are optional. Click on their name to see how the default values are determined.
An example configuration looks like this:
-Delastic.apm.service_name=my-cool-service
-Delastic.apm.application_packages=org.example,org.another.example
-Delastic.apm.server_url=http://127.0.0.1:8200
service_name=my-cool-service
application_packages=org.example,org.another.example
server_url=http://127.0.0.1:8200
ELASTIC_APM_SERVICE_NAME=my-cool-service
ELASTIC_APM_APPLICATION_PACKAGES=org.example,org.another.example
ELASTIC_APM_SERVER_URL=http://127.0.0.1:8200
This is a list of all configuration options grouped by their category. Click on a key to get more information.
-
circuit_breaker_enabled
([1.14.0] performance)stress_monitoring_interval
(performance)stress_monitor_gc_stress_threshold
(performance)stress_monitor_gc_relief_threshold
(performance)stress_monitor_cpu_duration_threshold
(performance)stress_monitor_system_cpu_stress_threshold
(performance)stress_monitor_system_cpu_relief_threshold
(performance)
-
recording
([1.15.0])enabled
([1.18.0])instrument
([1.0.0])service_name
service_node_name
([1.11.0])service_version
hostname
([1.10.0])environment
transaction_sample_rate
(performance)transaction_max_spans
(performance)long_field_max_length
(performance [1.37.0])sanitize_field_names
(security)enable_instrumentations
([1.28.0])disable_instrumentations
([1.0.0])enable_experimental_instrumentations
([1.25.0])unnest_exceptions
ignore_exceptions
([1.11.0])capture_body
(performance)capture_headers
(performance)global_labels
([1.7.0])instrument_ancient_bytecode
([1.35.0])context_propagation_only
([1.44.0])classes_excluded_from_instrumentation
trace_methods
([1.0.0])trace_methods_duration_threshold
([1.7.0])central_config
([1.8.0])breakdown_metrics
([1.8.0])config_file
([1.8.0])plugins_dir
(experimental)use_elastic_traceparent_header
([1.14.0])disable_outgoing_tracecontext_headers
([1.37.0])span_min_duration
([1.16.0])cloud_provider
([1.21.0])enable_public_api_annotation_inheritance
(performance)transaction_name_groups
([1.33.0])trace_continuation_strategy
([1.34.0])baggage_to_attach
([1.43.0])
-
universal_profiling_integration_enabled
([1.50.0])universal_profiling_integration_buffer_size
([1.50.0])universal_profiling_integration_socket_dir
([1.50.0])profiling_inferred_spans_enabled
([1.15.0] experimental)profiling_inferred_spans_logging_enabled
([1.37.0])profiling_inferred_spans_sampling_interval
([1.15.0])profiling_inferred_spans_min_duration
([1.15.0])profiling_inferred_spans_included_classes
([1.15.0])profiling_inferred_spans_excluded_classes
([1.15.0])profiling_inferred_spans_lib_directory
([1.18.0])