Trace Azure Functions with OpenTelemetry .NET

The OpenTelemetry Protocol (OTLP) exporters for .NET currently support gRPC and HTTP 1.1 with binary Protocol Buffers (Protobuf) payload transports. Supported corresponding protocol values are grpc and http/protobuf. Configuration options can be set either via environment variables or explicitly in code.

Prerequisites

The following prerequisites and limitations apply:

  • Dynatrace version 1.222+
  • W3C Trace Context is enabled
    1. Go to Settings > Preferences > OneAgent features.
    2. Turn on Send W3C Trace Context HTTP headers.

Instrument Azure Functions

Dynatrace uses OpenTelemetry Trace Ingest to provide end-to-end visibility to your Azure Functions.

To instrument your Azure Functions

Step 1 Set up export

Step 2 Add dependencies

Add the following dependencies via NuGet to your project:

OpenTelemetry.Exporter.OpenTelemetryProtocol

OpenTelemetry also provides other auto-instrumentation libraries available as NuGet packages.

Step 3 Instrument code with OpenTelemetry