Configure the Splunk Distribution of OpenTelemetry .NET 🔗
You can configure the Splunk Distribution of OpenTelemetry .NET to suit your instrumentation needs. In most cases, modifying the basic configuration is enough to get started. More advanced settings are also available.
Configuration methods 🔗
You can change the settings of the Splunk Distribution of OpenTelemetry .NET in the following ways:
For .NET applications, set environment variables. On Windows, set them in the process scope unless you want to activate automatic instrumentation globally for all .NET applications.
For .NET Framework applications running as Windows services, you can add settings in the
appSettings
block of the app.config file when supported or set environment variables using the Windows Registry.For ASP.NET applications, add settings in the
appSettings
block of the web.config file. For example:<configuration> <appSettings> <add key="OTEL_SERVICE_NAME" value="my-service-name" /> </appSettings> </configuration>
Alternatively, you can set environment variables using any of the following methods:
Add the
<environmentVariables>
element inapplicationHost.config
for your application pools.Set the environment variables for
W3SVC
andWAS
.
For ASP.NET Core applications, add
<environmentVariable>
elements inside the<aspNetCore>
block of your web.config file.
General settings 🔗
The following settings are common to most instrumentation scenarios:
Setting |
Description |
---|---|
|
Activated by default. Adds server trace information to HTTP response headers. For more information, see Server trace information. The default value is |
|
Names of the executable files that you don’t want the profiler to instrument. Supports multiple semicolon-separated values, for example: |
|
Traces are collected by default. To deactivate trace collection, set the environment variable to |
|
Metrics are collected by default. To deactivate metric collection, set the environment variable to |
|
Logs are collected by default. To deactivate log collection, set the environment variable to |
|
Activates the OpenTracing tracer. The default value is |
|
Activates immediate redirection of the assemblies used by the automatic instrumentation on the .NET Framework. The default values is |
|
Controls whether the telemetry data is flushed when an |
|
Activates RuleEngine. The default values is |
|
Activate to let the process fail when automatic instrumentation can’t be executed. This setting is for debugging purposes, don’t use it in production environments. The default value is |
Exporter settings 🔗
The following settings control trace exporters and their endpoints:
Setting |
Description |
---|---|
|
The URL to where traces and metrics are sent. The default value is |
|
The name of your organization’s realm, for example, |
|
A Splunk authentication token that lets exporters send data directly to Splunk Observability Cloud. Unset by default. Required if you need to send data to the Splunk Observability Cloud ingest endpoint. See Create and manage authentication tokens using Splunk Observability Cloud. |
Trace propagation settings 🔗
The following settings control trace propagation:
Setting |
Description |
---|---|
|
Comma-separated list of propagators for the tracer. The default value is |
Samplers configuration 🔗
The following settings control trace sampling:
Environment variable |
Description |
---|---|
|
Sampler to use. The default value is |
|
Semicolon-separated list of rules for the |
Resource detectors configuration 🔗
You can use resource detectors to retrieve additional attributes for your application’s spans.
The following settings control resource detectors:
Environment variable |
Description |
---|---|
|
Activates or deactivates all resource detectors. The default values is |
|
Activates or deactivates a specific resource detector, where |
The following resource detectors are available:
Detector ID |
Description |
Attributes |
Maturity level |
Support level |
---|---|---|---|---|
|
Azure App Service detector. |
|
Experimental Beta |
Community support |
|
Container detector. For example, Docker or Podman containers. |
|
Experimental Beta |
Community support |
Instrumentation settings 🔗
The following settings control instrumentations and tracing behavior:
Setting |
Description |
---|---|
|
Name of the service or application you’re instrumenting. Takes precedence over the service name defined in the |
|
Comma-separated list of resource attributes added to every reported span. For example, |
|
Comma-separated list of additional |
|
Comma-separated list of additional |
|
Maximum number of attributes per span. Default value is unlimited. |
|
Maximum number of events per span. Default value is unlimited. |
|
Maximum number of links per span. Default value is |
|
Maximum length of strings for attribute values. Values larger than the limit are truncated. Default value is |
|
Whether the GraphQL instrumentation can pass raw queries as a |
|
Comma-separated list of additional legacy source names to be added to the tracer at the startup. Use it to capture |
The following settings control which instrumentations are activated. See Deactivate specific instrumentations for more information.
Setting |
Description |
---|---|
|
Activates or deactivates all instrumentations. The default value is |
|
Activates or deactivates all trace instrumentations. Overrides |
|
Activates or deactivates a specific trace instrumentation, where |
|
Activates or deactivates all metric instrumentations. Overrides |
|
Activates or deactivates a specific metric instrumentation, where |
|
Activates or deactivates all log instrumentations. Overrides |
|
Activates or deactivates a specific log instrumentation, where |
Server trace information 🔗
To connect Real User Monitoring (RUM) requests from mobile and web applications with server trace data, trace response headers are activated by default. The instrumentation adds the following response headers to HTTP responses:
Access-Control-Expose-Headers: Server-Timing
Server-Timing: traceparent;desc="00-<serverTraceId>-<serverSpanId>-01"
The Server-Timing
header contains the traceId
and spanId
parameters in traceparent
format. For more information, see the Server-Timing and traceparent documentation on the W3C website.
Note
If you need to deactivate trace response headers, set SPLUNK_TRACE_RESPONSE_HEADER_ENABLED
to false
.
Diagnostic logging settings 🔗
The following settings control the internal logging of the Splunk Distribution of OpenTelemetry .NET:
Setting |
Description |
---|---|
|
Sets the logging level for instrumentation log messages. Possible values are |
|
Directory of the .NET tracer logs. The default value is |
|
Whether the traces console exporter is activated. The default value is |
|
Whether the metrics console exporter is activated. The default value is |
|
Whether the logs console exporter is activated. The default value is |
|
Whether the log state have to be formatted. The default value is |
Changing the default service name 🔗
By default, the Splunk Distribution of OpenTelemetry .NET retrieves the service name by trying the following steps until it succeeds:
The default service name is the name of the entry assembly. For example, the name of your .NET project file. For ASP.NET applications, the default service name is
SiteName[/VirtualPath]
.If the entry assembly is not available, the instrumentation tries to use the current process name. The process name can be
dotnet
if launched directly using an assembly. For example,dotnet InstrumentedApp.dll
.
If all the steps fail, the service name defaults to unknown_service
.
Note
To override the default service name, set the OTEL_SERVICE_NAME
environment variable.
Environment variables for manual installation 🔗
When deploying the instrumentation manually, you need to make sure to set the following environment variables:
Environment variable |
Value |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Environment variable |
Value |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Environment variable |
Value |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note
The default installation path on Linux is $HOME/.otel-dotnet-auto
.