Skip to content

Latest commit

 

History

History
89 lines (68 loc) · 3.28 KB

File metadata and controls

89 lines (68 loc) · 3.28 KB

OpenTelemetry .NET SDK

NuGet NuGet

Installation

dotnet add package OpenTelemetry

Introduction

OpenTelemetry SDK is a reference implementation of the OpenTelemetry API. It implements the Tracing API, the Metrics API, and the Context API. OpenTelemetry SDK deals with concerns such as sampling, processing pipeline, exporting telemetry to a particular backend etc. The default implementation consists of the following.

  • Set of Built-in samplers
  • Set of Built-in processors.
    • SimpleProcessor which sends Activities to the exporter without any batching.
    • BatchingProcessor which batches and sends Activities to the exporter.
  • Extensibility options for users to customize SDK.

Getting started

Please follow the tutorial and get started in 5 minutes.

Configuration

Instrumentation

Processor

Resource

Sampler

Samplers are used to control the noise and overhead introduced by OpenTelemetry by reducing the number of samples of traces collected and sent to the backend. If no sampler is explicitly specified, the default is to use AlwaysOnSampler. The following example shows how to change it to TraceIdRatioBasedSampler with sampling probability of 25%.

using OpenTelemetry;
using OpenTelemetry.Trace;

using var otel = Sdk.CreateTracerProvider(b => b
    .AddActivitySource("MyCompany.MyProduct.MyLibrary")
    .SetSampler(new TraceIdRatioBasedSampler(0.25))
    .UseConsoleExporter());

Advanced topics

References