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:
Exporter settings π
The following settings control trace exporters and their endpoints:
.NET OTel settings for AlwaysOn Profiling π
The following settings control the AlwaysOn Profiling feature for the .NET instrumentation:
Note
AlwaysOn Profiling for .NET is compatible with .NET 6.0 and higher. For more information on AlwaysOn Profiling, see Introduction to AlwaysOn Profiling for Splunk APM.
Trace propagation settings π
The following settings control trace propagation:
Samplers configuration π
The following settings control trace sampling:
Resource detectors configuration π
You can use resource detectors to retrieve additional attributes for your applicationβs spans.
The following settings control resource detectors:
The following resource detectors are available:
Instrumentation settings π
The following settings control instrumentations and tracing behavior:
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:
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
.