Docs » Supported integrations in Splunk Observability Cloud » Instrument back-end applications to send spans to Splunk APM » Instrument .NET applications for Splunk Observability Cloud (OpenTelemetry) » Configure the Splunk Distribution of OpenTelemetry .NET

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 in applicationHost.config for your application pools.

    • Set the environment variables for W3SVC and WAS.

  • 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:

  1. 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].

  2. 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

CORECLR_ENABLE_PROFILING

1

CORECLR_PROFILER

{918728DD-259F-4A6A-AC2B-B85E1B658318}

CORECLR_PROFILER_PATH_64

$installationLocation\win-x64\OpenTelemetry.AutoInstrumentation.Native.dll

CORECLR_PROFILER_PATH_32

$installationLocation\win-x86\OpenTelemetry.AutoInstrumentation.Native.dll

DOTNET_ADDITIONAL_DEPS

$installationLocation\AdditionalDeps

DOTNET_SHARED_STORE

$installationLocation\store

DOTNET_STARTUP_HOOKS

$installationLocation\net\OpenTelemetry.AutoInstrumentation.StartupHook.dll

OTEL_DOTNET_AUTO_HOME

$installationLocation

OTEL_DOTNET_AUTO_PLUGINS

Splunk.OpenTelemetry.AutoInstrumentation.Plugin, Splunk.OpenTelemetry.AutoInstrumentation