Skip to main content
One setup function sends logs, metrics, and traces from your Go application to Bronto. Logs are bridged from log/slog, metrics flow through a meter provider, and traces through a tracer provider — all three sharing one resource identity and one OTLP/HTTP exporter configuration. The application exports to an OpenTelemetry Collector, which forwards to Bronto. If you don’t run a Collector, export directly to Bronto instead — the code is identical, only two environment variables change.

Prerequisites

  • Go 1.21 or later (required for log/slog)
  • An OTel Collector reachable from your application, with logs, metrics, and traces pipelines forwarding to Bronto — see Connect OpenTelemetry Collector to Bronto

Install dependencies

Configure the environment

The exporters read their endpoint from environment variables, so nothing in the code below is environment-specific.
The exporters append the signal path (/v1/logs, /v1/metrics, /v1/traces) to OTEL_EXPORTER_OTLP_ENDPOINT, and the URL scheme decides TLS — http:// for a plaintext local Collector, https:// for a secured one. Two resource attributes determine how Bronto organises your data:
http://localhost:4318 is the standard OTLP/HTTP address for a Collector on the same host. Use the address reachable from your application if the Collector runs in another container, pod, or host. No authentication is needed between the application and the Collector — the Collector holds the Bronto API key.

Initialise the SDK

otel.go

Instrument your application

Existing slog calls need no changes. Add spans and instruments for your own business logic:
main.go
Use the Context-aware slog methods — InfoContext, WarnContext, ErrorContext — and pass the context returned by tracer.Start. That is what lets the bridge attach trace_id and span_id, so you can jump from a log line to its trace in Bronto.
Go has no runtime auto-instrumentation. For HTTP servers and clients, wrap your handlers with otelhttp; equivalent packages exist for gRPC, database/sql, and popular frameworks — see Go instrumentation libraries. To get traces and RED metrics from Go services with no code changes at all, see eBPF instrumentation.

Verify

Run your application, then check each signal in Bronto, filtering by the service.name you set:
  • Logs — the Search page, in the dataset named after your service
  • Metrics — the Metric Explorer
  • Traces — the Explore Traces page
If nothing arrives:
  • Confirm the Collector is running and reachable at OTEL_EXPORTER_OTLP_ENDPOINT, and that its pipelines include an otlp receiver and the Bronto exporters.
  • Confirm the endpoint includes a scheme. Without http://, the exporters attempt TLS against a plaintext Collector.
  • The batch processors export on a background goroutine — keep the defer shutdown(...) call so short-lived programs flush before exit.
For signal-specific reference material, see Send Metrics to Bronto and Send Traces to Bronto.

Direct export to Bronto

Without a Collector, the application exports straight to Bronto over OTLP/HTTP. The code in otel.go is unchanged — point the endpoint at your Bronto region and add your API key:
See API Keys for how to create a key with ingestion permissions.
Prefer the Collector for multi-service environments — it batches, filters, and enriches telemetry, and keeps the API key out of every application. Direct export suits single services and simple architectures.

GenAI semantic conventions

If your application calls an LLM, OpenTelemetry’s GenAI semantic conventions define gen_ai.* span attributes for model, token usage, and prompt and response content.

Manual spans

There is no first-party GenAI auto-instrumentation package for Go, so set the attributes yourself around each model call:
Message content (gen_ai.input.messages / gen_ai.output.messages) is opt-in by convention and off by default in the languages that have auto-instrumentation. Since you are setting attributes by hand, apply the same discipline — gate prompt and response content behind your own config flag rather than always sending it. See the GenAI span conventions for the full attribute list. For the recommended attribute set and Bronto search queries, see LLM Observability.