Skip to main content
This page covers instrumenting a Go application with the OpenTelemetry SDK to send logs and traces to Bronto over OTLP/HTTP via a local OTel Collector. Both signals are co-equal: logs are bridged from log/slog — no log statement changes needed — and traces are emitted via a tracer provider.
If you don’t have a Collector and want to export directly from your application to Bronto, see Direct export to Bronto at the bottom of this page.

Prerequisites

Install dependencies

Configure the log bridge

The otelslog bridge replaces the default slog handler. All slog.Info(), slog.Warn(), and slog.Error() calls are forwarded to the OTel pipeline automatically.
otel_logging.go

Configure the OTLP exporter

The otlploghttp.New call in the snippet above connects to the OTel Collector on localhost:4318 without TLS. If your Collector runs on a different host or port, update WithEndpoint accordingly. To use TLS, remove WithInsecure() and ensure your Collector is configured with a valid certificate.

Set resource attributes

Resource attributes are attached to every log record exported from this process. Two attributes drive how Bronto organises incoming logs: These are set via resource.WithAttributes in the setup above.

Complete example

main.go
defer shutdown(context.Background()) flushes any buffered log records before the process exits.

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.
If no logs appear, check:
  • The OTel Collector is running and reachable at the configured endpoint.
  • The Collector’s pipeline includes a logs pipeline with an otlp receiver and the Bronto exporter — see Connect Open Telemetry to Bronto.
  • logging.Configure is called before the first slog statement.
  • The shutdown function is called before process exit to flush buffered records.

Traces

The go.opentelemetry.io/contrib/instrumentation packages provide instrumentation for net/http, gRPC, database drivers, and more with minimal setup. For example, wrap your HTTP handler with otelhttp.NewHandler for automatic span creation per request. See Go instrumentation libraries for the full list.

Install tracing dependencies

Configure the tracer provider

otel_tracing.go
Pass the same res from Configure so both signals share service.name and service.namespace.

Creating spans

Use slog.InfoContext (with the span context) to ensure the active span’s IDs are propagated to the log record.

Complete example

main.go

GenAI semantic conventions

If your application calls an LLM, OpenTelemetry defines GenAI semantic conventions. There is no first-party GenAI auto-instrumentation package for Go yet — set the attributes yourself around each LLM call:
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.
Message content (gen_ai.input.messages / gen_ai.output.messages) is opt-in by convention in languages with auto-instrumentation, off by default. Since you’re setting attributes by hand here, apply the same discipline — gate prompt/response content behind your own config flag rather than always sending it.
See LLM Observability for the full recommended attribute set 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 configurations with the Bronto OTLP endpoints and 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.