This page covers instrumenting a .NET application with the OpenTelemetry SDK to send logs and traces to Bronto over OTLP/HTTP via a local OTel Collector. Logs are bridged fromDocumentation Index
Fetch the complete documentation index at: https://docs.bronto.io/llms.txt
Use this file to discover all available pages before exploring further.
ILogger — no log statement changes needed. Traces are added by configuring a tracer provider alongside the log provider.
Prerequisites
- .NET 6 or later
- NuGet
- A running OTel Collector configured to forward logs to Bronto — see Connect Open Telemetry to Bronto
- OpenTelemetry .NET SDK documentation
Install dependencies
| Package | Purpose |
|---|---|
OpenTelemetry | Core OTel SDK |
OpenTelemetry.Extensions.Hosting | ILogger bridge and hosted service integration |
OpenTelemetry.Exporter.OpenTelemetryProtocol | OTLP/HTTP exporter |
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:| OTel attribute | Bronto concept | Description |
|---|---|---|
service.name | Dataset | Groups logs from one service |
service.namespace | Collection | Groups related services or a team’s services |
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 log collection
After running your application, open the Search page in Bronto. Filter by the dataset name you set inservice.name — your log records should appear within a few seconds.
If no logs appear, check:
- 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.
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:| Region | Logs endpoint | Traces endpoint |
|---|---|---|
| EU | https://ingestion.eu.bronto.io/v1/logs | https://ingestion.eu.bronto.io/v1/traces |
| US | https://ingestion.us.bronto.io/v1/logs | https://ingestion.us.bronto.io/v1/traces |

