dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
export OTEL_EXPORTER_OTLP_ENDPOINT=https://logfire-us.pydantic.dev
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=your-write-token'
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
var activitySource = new ActivitySource("hello-dotnet");
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddSource("hello-dotnet")
.ConfigureResource(r => r.AddService("hello-dotnet"))
.AddOtlpExporter()
.Build();
using var activity = activitySource.StartActivity("hello");
The name passed to AddSource must match the ActivitySource you create, or spans are dropped silently. There is
no Logfire .NET SDK to adopt: these are base class library types exported over standard OTLP. Full details are in the .NET setup guide.