How-to guides¶
Each guide solves one problem and assumes you already have a provider building. If none of that is true yet, start with Getting started.
- Wire OTLP logs, metrics and traces: all three providers against one resource, and resolving one shared endpoint with per-signal overrides.
- Send telemetry to the terminal or a file: print metrics, spans and logs as log lines through any slog logger, or write them as OTLP JSON lines, with no collector running.
- Correlate logs with traces: make records carry
trace_idandspan_id, keep stderr output alongside OTLP, and put a level floor on the bridge. - Record an error on a span: put a go/errors error on the active span with its kind, origin stack and hints, fail the span, and send exceptions as log-based events.
- Instrument an operation: record rate, errors and duration for a piece of business logic.
- Instrument a database: query rate, errors and duration under semantic-convention names, plus connection pool usage.
- Instrument a cache: hit ratio, evictions, size and capacity.
- Instrument a circuit breaker: its state, trips, short-circuits, successes and failures.
- Instrument a queue: depth, items in and out, and how long they wait and take to process.
- Diagnose telemetry that never arrives: the checklist for a service whose providers build without error and whose backend stays empty.
Guides that do not exist yet¶
Worth saying plainly, so you do not go looking:
- Exporting over OTLP/gRPC. Not supported. Only OTLP/HTTP exporters are built.
- Switching to a Prometheus or Jaeger exporter. Not built in. Implement
otelcore.Exporterand pass it asSettings.Exporter. - Instrumenting HTTP handlers. Use
otelhttp,otelgrpcand the OTel contrib instrumentation.instrumentcovers your own operations, not the transport.
What this module does not do covers the full list and the reasoning.