ILogger — no log statement changes needed — and traces are emitted via a tracer provider.
Prerequisites
- .NET 6 or later
- NuGet
- A running OTel Collector configured to forward logs and traces to Bronto — see Connect Open Telemetry to Bronto
- OpenTelemetry .NET SDK documentation
Install dependencies
Configure the log bridge
The OTel .NET SDK integrates withMicrosoft.Extensions.Logging via AddOpenTelemetry(). Every log record emitted through ILogger is forwarded to the OTel pipeline automatically.
For ASP.NET Core or any host using Microsoft.Extensions.Hosting, configure logging in Program.cs:
Program.cs
IncludeFormattedMessage attaches the rendered log message as the OTel record body. IncludeScopes propagates any active ILogger scope values as structured attributes.
Configure the OTLP exporter
Wire the OTLP exporter into the logging pipeline. By default the OTel Collector listens for OTLP/HTTP on port4318.
Program.cs
Set resource attributes
Resource attributes are attached to every log record exported from this process. Two attributes drive how Bronto organises incoming logs:
Set them via
ConfigureResource on the OpenTelemetryBuilder:
Program.cs
Complete example
The snippet below shows the fullProgram.cs setup for an ASP.NET Core application.
Program.cs
For non-hosted applications (console apps, workers), use
LoggerFactory.Create with the same AddOpenTelemetry and AddOtlpExporter calls instead of builder.Logging.Verify delivery
After running your application, check both signals in Bronto:- Logs: open the Search page and filter by the dataset name you set in
service.name— your log records should appear within a few seconds. - Traces: open the Explore Traces page and filter by the same
service.name— your spans should appear within a few seconds.
- The OTel Collector is running and reachable at the configured endpoint.
- The Collector’s pipeline includes a
logspipeline with anotlpreceiver and the Bronto exporter — see Connect Open Telemetry to Bronto. - The
OtlpExportProtocol.HttpProtobufprotocol matches the Collector’s configured receiver.
Traces
Configure the tracer provider
No additional packages are needed —OpenTelemetry.Extensions.Hosting and OpenTelemetry.Exporter.OpenTelemetryProtocol already include tracing support.
Add WithTracing to the same AddOpenTelemetry call you used for logging:
Program.cs
ConfigureResource applies to both logs and traces — service.name and service.namespace are shared automatically.
Creating spans
InjectActivitySource and use it to create spans around operations you want to trace:
ILogger call made inside an active Activity span will have trace_id and span_id injected automatically.
GenAI semantic conventions
If your application calls an LLM, OpenTelemetry defines GenAI semantic conventions for model, token usage, and prompt/response content.This page was verified on July 17, 2026. GenAI libraries and semantic conventions are evolving rapidly, so package configuration and emitted attributes can change between releases. Keep your instrumentation current and verify the fields emitted by the version you deploy.
Auto-instrumentation
Several .NET AI libraries provide GenAI telemetry, but each has its own opt-in:- Semantic Kernel: enable
SEMANTICKERNEL_EXPERIMENTAL_GENAI_ENABLE_OTEL_DIAGNOSTICS=true, then add its activity source:
- OpenAI .NET SDK: enable its experimental OpenTelemetry switch with
AppContext.SetSwitch("OpenAI.Experimental.EnableOpenTelemetry", true), then addOpenAI.*as a source. - Microsoft.Extensions.AI: wrap an
IChatClientwithUseOpenTelemetry(); setEnableSensitiveDatawhen you intentionally want message content recorded. - AWS SDK:
OpenTelemetry.Instrumentation.AWScovers Bedrock Runtime and Agent Runtime clients.
Experimental: capturing prompt and response content
Content capture is configured by the .NET library rather than the cross-language OTel environment variables. For Semantic Kernel, use the sensitive diagnostics opt-in:Manual spans
gen_ai.input.messages / gen_ai.output.messages, and how to search and aggregate GenAI fields in Bronto.
Direct export to Bronto
If you are not using an OTel Collector, export directly to Bronto by replacing the exporter endpoints and adding your API key:
See API Keys for how to create a key with ingestion permissions. No other changes to the rest of the setup are required.

