Advanced configuration

March 17, 2026 ยท View on GitHub

The official Splunk documentation for this page is Configure the Java agent. For instructions on how to contribute to the docs, see CONTRIBUTING.md.

Advanced configuration

The agent can be configured in the following ways:

  • System property (example: -Dotel.resource.attributes=service.name=my-java-app)
  • Environment variable (example: export OTEL_RESOURCE_ATTRIBUTES=service.name=my-java-app)

System property values take priority over corresponding environment variables.

Below you will find all the configuration options supported by this distribution.

Splunk configuration

System propertyEnvironment variableDefault valueSupportDescription
splunk.access.tokenSPLUNK_ACCESS_TOKENunsetStable(Optional) Auth token allowing exporters to communicate directly with the Splunk cloud, passed as X-SF-TOKEN header.
splunk.realmSPLUNK_REALMnoneStableSpecify your organization's realm name, such as us0 or `us1. When the realm is set, telemetry data is sent directly to the ingest endpoint of Splunk Observability Cloud, bypassing the Splunk Distribution of the OpenTelemetry Collector. If no realm is specified, telemetry is routed to a Splunk OpenTelemetry Collector deployed locally. This configuration applies only to metrics and traces.
splunk.metrics.force_full_commandlineSPLUNK_METRICS_FORCE_FULL_COMMANDLINEfalseExperimentalAdds the full command line as a resource attribute for all metrics. If false, commands longer than 255 characters are truncated.
splunk.trace-response-header.enabledSPLUNK_TRACE_RESPONSE_HEADER_ENABLEDtrueStableEnables adding server trace information to HTTP response headers. See this document for more information.

Trace exporters

System propertyEnvironment variableDefault valueSupportDescription
otel.exporter.otlp.endpointOTEL_EXPORTER_OTLP_ENDPOINThttp://localhost:4317StableThe OTLP endpoint to connect to. Setting this will override the splunk.realm property.
otel.traces.exporterOTEL_TRACES_EXPORTERotlpStableSelect the traces exporter to use. We recommend using the default OTLP exporter (otlp)

The Splunk Distribution of OpenTelemetry Java uses the OTLP traces exporter as the default setting.

Trace propagation configuration

System propertyEnvironment variableDefault valueSupportDescription
otel.propagatorsOTEL_PROPAGATORStracecontext,baggageStableA comma-separated list of propagators that will be used. You can find the list of supported propagators here.

If you wish to be compatible with older versions of the Splunk Distribution of OpenTelemetry Java (or the SignalFx Tracing Java Agent) you can set the trace propagator to B3:

export OTEL_PROPAGATORS=b3multi

Trace configuration

System propertyEnvironment variableDefault valueSupportDescription
otel.instrumentation.common.peer-service-mappingOTEL_INSTRUMENTATION_COMMON_PEER_SERVICE_MAPPINGunsetStableUsed to add a peer.service attribute by specifying a comma separated list of mapping from hostnames or IP addresses.
ExampleIf set to 1.2.3.4=cats-service,dogs-service.serverlessapis.com=dogs-api, requests to 1.2.3.4 will have a peer.service attribute of cats-service and requests to dogs-service.serverlessapis.com will have one of dogs-api.
otel.instrumentation.methods.includeOTEL_INSTRUMENTATION_METHODS_INCLUDEunsetStableSame as adding @WithSpan annotation functionality for the target method string.
Formatmy.package.MyClass1[method1,method2];my.package.MyClass2[method3]
otel.instrumentation.opentelemetry-annotations.exclude-methodsOTEL_INSTRUMENTATION_OPENTELEMETRY_ANNOTATIONS_EXCLUDE_METHODSunsetStableSuppress @WithSpan instrumentation for specific methods.
Formatmy.package.MyClass1[method1,method2];my.package.MyClass2[method3]
otel.resource.attributesOTEL_RESOURCE_ATTRIBUTESunsetStableComma-separated list of resource attributes added to every reported span.
Examplekey1=val1,key2=val2
otel.service.nameOTEL_SERVICE_NAMEunsetStableSets the value of the service.name resource attribute. If service.name is also set in otel.resource.attributes, this setting takes precedence.
otel.span.attribute.count.limitOTEL_SPAN_ATTRIBUTE_COUNT_LIMITunlimitedStableMaximum number of attributes per span.
otel.span.event.count.limitOTEL_SPAN_EVENT_COUNT_LIMITunlimitedStableMaximum number of events per span.
otel.span.link.count.limitOTEL_SPAN_LINK_COUNT_LIMIT1000StableMaximum number of links per span.

Sampling configuration

System propertyEnvironment variableDefault valueSupportDescription
otel.traces.samplerOTEL_TRACES_SAMPLERalways_onStableThe sampler to use for tracing.

Splunk Distribution of OpenTelemetry Java supports all standard samplers as provided by OpenTelemetry Java SDK Autoconfigure. In addition, the distribution adds the following samplers:

internal_root_off

Setting otel.traces.sampler to internal_root_off drops all traces with root spans where spanKind is INTERNAL, CLIENT or PRODUCER. This setting only keeps root spans where spanKind is SERVER and CONSUMER.

rules

This sampler allows to ignore individual endpoints and drop all traces that originate from them. It applies only to spans with SERVER kind.

For example, the following configuration results in all requests to /healthcheck to be excluded from monitoring:

export OTEL_TRACES_SAMPLER=rules
export OTEL_TRACES_SAMPLER_ARG=drop=/healthcheck;fallback=parentbased_always_on

All requests to downstream services that happen as a consequence of calling an excluded endpoint are also excluded.

The value of OTEL_TRACES_SAMPLER_ARG is interpreted as a semicolon-separated list of rules. The following types of rules are supported:

  • drop=<value>: The sampler drops a span if its url.path attribute has a substring equal to the provided value. You can provide as many drop rules as you want.
  • fallback=sampler: Fallback sampler used if no drop rule matched a given span. Supported fallback samplers are always_on and parentbased_always_on. Probability samplers such as traceidratio are not supported.

If several fallback rules are provided, only the last one will be in effect.

If OTEL_TRACES_SAMPLER_ARG is not provided or has en empty value, no drop rules are configured and parentbased_always_on sampler is as default.

Java agent configuration

System propertyEnvironment variableDefault valueSupportDescription
otel.javaagent.enabledOTEL_JAVAAGENT_ENABLEDtrueStableGlobally enables javaagent auto-instrumentation.

Profiler settings

SettingDefaultDescription
splunk.profiler.enabledfalseset to true to enable the profiler
splunk.profiler.directorysystem temp directorylocation of JFR files, defaults to System.getProperty("java.io.tmpdir")
splunk.profiler.recording.duration20srecording unit duration
splunk.profiler.keep-filesfalseleave JFR files on disk if true
splunk.profiler.logs-endpointhttp://localhost:4318/v1/logswhere to send OTLP logs, defaults to otel.exporter.otlp.endpoint
splunk.profiler.call.stack.interval10000mshow often to sample call stacks
splunk.profiler.memory.enabledfalseset to true to enable all other memory profiling options unless explicitly disabled. Setting to true enables metrics.
splunk.profiler.memory.event.rate150/sallocation event rate
splunk.profiler.include.internal.stacksfalseset to true to include stack traces of agent internal threads and stack traces with only JDK internal frames
splunk.profiler.tracing.stacks.onlyfalseset to true to include only stack traces that are linked to a span context
splunk.profiler.otlp.protocolhttp/protobufThe transport protocol to use on profiling OTLP log requests. Options include grpc and http/protobuf.

If the splunk.profiler.enabled option is not enabled, all profiling features are disabled. For example, setting splunk.profiler.memory.enabled to true has no effect if splunk.profiler.enabled is set to false. Similarly, there is no separate toggle for periodic collection of call stacks (thread dumps), as this feature is enabled only when the profiler is enabled.

Note: Setting splunk.profiler.memory.enabled to true automatically activates the splunk metrics.

Other OpenTelemetry Java agent configuration

You can find all other Java agent configuration options described here.