Configuration
Agent Configuration
The agent can consume configuration from one or more of the following sources (ordered from highest to lowest priority):
- System properties
- Environment variables
- Configuration file
- Properties provided by the
AutoConfigurationCustomizer#addPropertiesSupplier()
function; using theAutoConfigurationCustomizerProvider
SPI
Configuring with Environment Variables
In some environments, configuring via Environment Variables is more preferred. Any setting configurable with a System Property can also be configured with an Environment Variable. Many settings below include both options, but where they don’t apply the following steps to determine the correct name mapping of the desired System Property:
- Convert the System Property to uppercase.
- Replace all
.
and-
characters with_
.
For example otel.instrumentation.common.default-enabled
would convert to
OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED
.
Configuration file
You can provide a path to agent configuration file by setting the following property:
System property:
otel.javaagent.configuration-file
Environment variable:
OTEL_JAVAAGENT_CONFIGURATION_FILE
Description: Path to valid Java properties file which contains the agent configuration.
Extensions
You can enable extensions by setting the following property:
System property:
otel.javaagent.extensions
Environment variable:
OTEL_JAVAAGENT_EXTENSIONS
Description: Path to an extension jar file or folder, containing jar files. If pointing to a folder, every jar file in that folder will be treated as separate, independent extension.
Java agent logging output
The agent’s logging output can be configured by setting the following property:
System property:
otel.javaagent.logging
Environment variable:
OTEL_JAVAAGENT_LOGGING
Description: The Java agent logging mode. The following 3 modes are supported:
simple
: The agent will print out its logs using the standard error stream. OnlyINFO
or higher logs will be printed. This is the default Java agent logging mode.none
: The agent will not log anything - not even its own version.application
: The agent will attempt to redirect its own logs to the instrumented application's slf4j logger. This works the best for simple one-jar applications that do not use multiple classloaders; Spring Boot apps are supported as well. The Java agent output logs can be further configured using the instrumented application's logging configuration (e.g.logback.xml
orlog4j2.xml
). Make sure to test that this mode works for your application before running it in a production environment.
SDK Configuration
The SDK’s autoconfiguration module is used for basic configuration of the agent. Read the docs to find settings such as configuring export or sampling.
Important
Unlike the SDK autoconfiguration, versions 2.0+ of the Java agent and OpenTelemetry Spring Boot starter usehttp/protobuf
as the default protocol,
not grpc
.Enable Resource Providers that are disabled by default
In addition to the resource configuration from the SDK autoconfiguration, you can enable additional resource providers that are disabled by default:
System property:
otel.resource.providers.aws.enabled
Environment variable:
OTEL_RESOURCE_PROVIDERS_AWS_ENABLED
Default: false
Description:
Enables the
AWS Resource Provider.
System property:
otel.resource.providers.gcp.enabled
Environment variable:
OTEL_RESOURCE_PROVIDERS_GCP_ENABLED
Default: false
Description:
Enables the
GCP Resource Provider.
Feedback
Cette page est-elle utile?
Thank you. Your feedback is appreciated!
Please let us know how we can improve this page. Your feedback is appreciated!