Documentation

OpenTelemetry Instrumentation for .NET

Overview

OpenTelemetry provides instrumentation for .NET applications, enabling you to collect telemetry data such as traces and metrics. Although Lumigo does not offer its own OpenTelemetry Distribution for .NET, you can still configure it. This guide explains how to set up OpenTelemetry .NET Automatic Instrumentation and configure it to report data to Lumigo.

Prerequisites

Before you begin, ensure you have the following:

  • A Lumigo Token, which can be found in Settings > Tracing > Manual Tracing. For more details, see the Lumigo Tokens documentation.
  • If using MacOS, make sure you have greadlink installed. It is available via the coreutils package using brew , which has greadlink included.
    brew install coreutils

Installation Steps

Install OpenTelemetry .NET Automatic Instrumentation and instrument your .NET application using the provided Shell scripts.

Installation Steps

1. Download the Installation Script

Download the OpenTelemetry .NET Automatic Instrumentation installation bash script using curl:

curl -sSfL https://raw.githubusercontent.com/open-telemetry/opentelemetry-dotnet-instrumentation/v1.0.2/otel-dotnet-auto-install.sh -O

2. Install core files:

Run the installation script to install the necessary core files:

sh ./otel-dotnet-auto-install.sh

3. Enable Execution for the Instrumentation Script

Make the instrumentation script executable:

chmod +x $HOME/.otel-dotnet-auto/instrument.sh

4. Setup Instrumentation for the Current Shell Session

Initialize the instrumentation for the current shell session by sourcing the script:

. $HOME/.otel-dotnet-auto/instrument.sh

5. Run Your .NET Application with OpenTelemetry Instrumentation

Run your .NET application with OpenTelemetry instrumentation enabled and configure it to report telemetry data to Lumigo:

OTEL_SERVICE_NAME=<YOUR_SERVICE_NAME> #OPTIONAL
OTEL_EXPORTER_OTLP_HEADERS="authorization=LumigoToken <YOUR_LUMIGO_TOKEN>"
OTEL_EXPORTER_OTLP_ENDPOINT="https://ga-otlp.lumigo-tracer-edge.golumigo.com"
OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf" ./MyNetApp

Replace <token> with your Lumigo token, which is available in Settings -> Tracing -> Manual tracing, see the Lumigo Tokens documentation.