Documentation forSolarWinds Observability SaaS

Configure OpenTelemetry Features in the .NET APM Library

Use the following sections for guidance and information about the environment variables available to configure different OpenTelemetry features. If an environment variable needs to be configured for a specific application pool, please see Configure an environment variable for an application pool.

Complete list of configuration options

The following is the complete list of instrumentation configuration options:

Traces Instrumentation

Enables trace instrumentation.

Environment Variable

OTEL_DOTNET_AUTO_TRACES_INSTRUMENTATION_ENABLED

Valid Values

true: Trace instrumentation is enabled. Default value.

false: Trace instrumentation is disabled.

Example

OTEL_DOTNET_AUTO_TRACES_INSTRUMENTATION_ENABLED=false

Specific Trace Instrumentation

Configuration pattern for enabling a specific trace instrumentation, where {instrumentation_id} is the uppercase id of the instrumentation you want to enable. Overrides OTEL_DOTNET_AUTO_TRACES_INSTRUMENTATION_ENABLED. The OpenTelemetry documentation lists the different instrumentations that are supported. See opentelemetry-dotnet-instrumentation/docs/config.md for more information.

Environment Variable Format

OTEL_DOTNET_AUTO_TRACES_{instrumentation_id}_INSTRUMENTATION_ENABLED

Valid Values

true: The specific trace instrumentation is enabled.

false: The specific trace instrumentation is disabled.

Default

All of the instrumentations are enabled by default when OpenTelemetry is enabled except for KAFKA instrumentation, which must be enabled using the environment variable, OTEL_DOTNET_AUTO_TRACES_KAFKA_INSTRUMENTATION_ENABLED=true.

Example

OTEL_DOTNET_AUTO_TRACES_ASPNETCORE_INSTRUMENTATION_ENABLED=false

Metrics Instrumentation

Enables metrics instrumentations.

Environment Variable

OTEL_DOTNET_AUTO_METRICS_INSTRUMENTATION_ENABLED

Valid Values

true: Metric instrumentation is enabled. Default value.

false: Metric instrumentation is disabled.

Example

OTEL_DOTNET_AUTO_METRICS_INSTRUMENTATION_ENABLED=false

Specific Metrics Instrumentation

Configuration pattern for enabling a specific metrics instrumentation, where {instrumentation_id} is the uppercase id of the metrics instrumentation you want to enable. Overrides OTEL_DOTNET_AUTO_METRICS_INSTRUMENTATION_ENABLED. The OpenTelemetry documentation lists the different metrics instrumentations that are supported. See opentelemetry-dotnet-instrumentation/docs/config.md for more information.

Environment Variable Format

OTEL_DOTNET_AUTO_METRICS_{instrumentation_id}_INSTRUMENTATION_ENABLED

Valid Values

true: The specific metrics instrumentation is enabled.

false: The specific metrics instrumentation is disabled.

Default

All of the metrics instrumentations are enabled by default when OpenTelemetry is enabled.

Example

OTEL_DOTNET_AUTO_METRICS_PROCESS_INSTRUMENTATION_ENABLED=false

Logs OTLP Exporting

Enables the exporting of OTLP logs. The OTEL_LOGS_EXPORTER environment variable along with the OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED environment variable below must be configured to enable the exporting of logs to the SolarWinds Observability collector.

Environment Variable

OTEL_LOGS_EXPORTER

Valid Values

none: The logs aren’t exported to the SolarWinds Observability collector. Default value.

otlp: The logs are exported to the SolarWinds Observability collector.

Example

OTEL_LOGS_EXPORTER=otlp

Logs Instrumentation

Enables logs instrumentation.

Environment Variable

OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED

Valid Values

true: Logs instrumentation is enabled.

false: Logs instrumentation is disabled. Default value.

Example

OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED=true

Specific Logs Instrumentation

Configuration pattern for enabling a specific logs instrumentation, where {instrumentation_id} is the uppercase id of the logs instrumentation you want to enable. Overrides OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED. The OpenTelemetry documentation lists the different logs instrumentations that are supported. See opentelemetry-dotnet-instrumentation/docs/config.md for more information.

Environment Variable Format

OTEL_DOTNET_AUTO_LOGS_{instrumentation_id}_INSTRUMENTATION_ENABLED

Valid Values

true: The specific logs instrumentation is enabled.

false: The specific logs instrumentation is disabled.

Default

All of the logs instrumentations are enabled by default when logs instrumentation is enabled using the OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED environment variable.

Example

OTEL_DOTNET_AUTO_LOGS_LOG4NET_INSTRUMENTATION_ENABLED=false

Logs Exporter - Include Formatted Message

Whether the formatted log message should be set or not.

Environment Variable

OTEL_DOTNET_AUTO_LOGS_INCLUDE_FORMATTED_MESSAGE

Valid Values

true: The formatted message will be included in the logs exported.

false: The formatted message will not be included in the logs exported. Default value.

Example

OTEL_DOTNET_AUTO_LOGS_INCLUDE_FORMATTED_MESSAGE=true

Log4Net Bridge

The log4net logs bridge is disabled by default. In order to enable it, set OTEL_DOTNET_AUTO_LOGS_ENABLE_LOG4NET_BRIDGE to true. The bridge is supported for log4net in versions 2.0.13 or later, but earlier than 4.0.0.

The bridge will export the application logs via OTLP. The exporting of the logs must also be enabled using the OTEL_LOGS_EXPORTER and OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED environment variables above.

Environment Variable

OTEL_DOTNET_AUTO_LOGS_ENABLE_LOG4NET_BRIDGE

Valid Values

true: The log4net bridge will be enabled.

false: The log4net bridge will be disabled. Default value.

Example

OTEL_DOTNET_AUTO_LOGS_ENABLE_LOG4NET_BRIDGE=true

More Information

https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/log4net-bridge.md

NLog Bridge

The NLog logs bridge is disabled by default. In order to enable it, set OTEL_DOTNET_AUTO_LOGS_ENABLE_NLOG_BRIDGE to true. Bridge is supported for NLOG in versions 5.0.0 or later, but earlier than 7.0.0.

The bridge will export the application logs via OTLP. The exporting of the logs must also be enabled using the OTEL_LOGS_EXPORTER and OTEL_DOTNET_AUTO_LOGS_INSTRUMENTATION_ENABLED environment variables above.

Environment Variable

OTEL_DOTNET_AUTO_LOGS_ENABLE_NLOG_BRIDGE

Valid Values

true: The NLog bridge will be enabled.

false: The NLog bridge will be disabled. Default value.

Example

OTEL_DOTNET_AUTO_LOGS_ENABLE_NLOG_BRIDGE=true

More Information

https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/nlog-bridge.md