Configuration
Serverless Observability Stack APM Agent Java
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.propertiesfile is located in the same folder as the agent jar, or provided through theconfig_fileoption.
-
- 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
-
--configparameter.
See Automatic setup withapm-agent-attach-cli.jar.
- Arguments of
ElasticApmAttacher.attach(...).
See Programmatic API setup to self-attach. elasticapm.propertiesin 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.propertiesfile- 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_nameservice_node_name([1.11.0])service_versionhostname([1.10.0])environmenttransaction_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_exceptionsignore_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_instrumentationtrace_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])
-
capture_body_content_types([1.5.0] performance)transaction_ignore_urlstransaction_ignore_user_agents([1.22.0])use_path_as_transaction_name([1.0.0])url_groups(deprecated)capture_http_client_request_body_size([1.52.0] experimental)capture_http_client_request_body_as_label([1.54.0] experimental)
-
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])