Docs » Instrument applications for Splunk APM » Instrument a .NET application

Instrument a .NET application 🔗


The original µAPM product, released in 2019, is now called µAPM Previous Generation (µAPM PG). Wherever you see the reference, µAPM now refers to the product released on March 31, 2020.

If you’re using µAPM Previous Generation (µAPM PG), see Overview of SignalFx Microservices APM Previous Generation (µAPM PG).

Automatically instrument a .NET application to capture and send traces to Splunk APM with the SignalFx Tracing Library for .NET. The SignalFx Tracing Library for .NET uses OpenTracing API 2.0 to instrument a .NET application. To set up instrumentation, see the SignalFx Tracing Library for .NET on GitHub.

The SignalFx Tracing library for .NET supports .NET Core 2.0+ on Linux and Windows.

The library also supports .NET Framework 4.5+ on Windows.

Configure the instrumentation to send traces to a Smart Agent. The Smart Agent forwards data to an APM ingest endpoint. Configure the Smart Agent to add tags to identify spans that belong to specific hosts or microservices. For more information about deploying a Smart Agent, see Deploy a SignalFx Smart Agent for Splunk APM.

If you want to configure instrumentation for an application and can’t deploy a Smart Agent, configure the instrumentation to send traces directly to an APM ingest endpoint, or to an OpenTelemetry Collector.

Optionally, deploy an OpenTelemetry Collector between a Smart Agent or instrumented code and an APM ingest endpoint. The OpenTelemetry Collector enables you to centrally manage configuration options, batching, retries, and authentication. For more information about deploying an OpenTelemetry Collector for APM, see Deploy an OpenTelemetry Collector for Splunk APM.

The SignalFx Tracing Library for .NET uses the Common Language Runtime’s (CLR) profiling API to instrument the Intermediate Language (IL) of supported libraries and frameworks. Install the utility with your system package manager after downloading the latest release of the SignalFx Tracing Library for .NET on GitHub.

The SignalFx Tracing Library for .NET doesn’t require direct code modification or additional dependencies for the CLR profiler. Instead, it provides an environment configuration that instructs child CLR processes to augment internal client and application functionality to report traced behavior to APM.

Add custom instrumentation to a .NET application 🔗

Build on the provided tracing functionality by modifying and adding to generated traces. The tracing insights the SignalFx Tracing Library for .NET provides can be the foundation of any elements you add later. Capture a more detailed representation of the logic and functionality of your application, clients, and framework by adding to the instrumentation the library already provides.

The SignalFx Tracing Library for .NET provides and registers an OpenTracing-compatible global tracer you can use like this:

using OpenTracing;
using OpenTracing.Util;

namespace MyProject
    public class MyClass
        public static void MyMethod()
            // Obtain the automatically registered OpenTracing.Util.GlobalTracer instance
            var tracer = GlobalTracer.Instance;

            // Create an active span that will be automatically parented by any existing span in this context
            using (IScope scope = tracer.BuildSpan("MyTracedFunctionality").StartActive(finishSpanOnDispose: true))
                var span = scope.Span;
                span.SetTag("MyImportantTag", "MyImportantValue");
                span.Log("My Important Log Statement");

                var ret = await MyAppFunctionality();

                span.SetTag("FunctionalityReturned", ret.ToString());