Go
<!-- status: ga language: go -->
Go: the wtotel helper
watchtower/sdk/wtotel wires the OpenTelemetry Go SDK (Apache-2.0) to Watchtower in one call: OTLP/HTTP exporters, gzip, batching, retry, the resource attributes service.name, service.version and deployment.environment.name, and an optional disk buffer so telemetry survives offline periods.
shutdown, err := wtotel.Init(ctx, wtotel.Options{
Endpoint: "https://ingest.example.com", // gateway base URL, no path
IngestKey: os.Getenv("WT_INGEST_KEY"), // wti_..., scope ingest:traces (+ ingest:metrics, ingest:logs)
ServiceName: "checkout",
Environment: "production",
Signals: wtotel.Traces | wtotel.Metrics | wtotel.Logs, // default: Traces
BufferDir: "/var/lib/checkout/wt-buffer", // optional offline buffer
})
if err != nil {
log.Fatal(err)
}
defer shutdown(context.Background()) // flushes batchesAfter Init, use otel.Tracer, otel.Meter and the OTel log bridge as usual; the helper installs the global providers.
Offline buffer
With BufferDir set, an export that fails (network error, HTTP 429 or 5xx) is written to a disk queue instead of being retried in memory. The next export that succeeds replays the queue, oldest first. Delivery is at-least-once: a crash during replay can send a stored batch twice. The queue is capped at BufferMaxBytes (default 512 MiB); when it is full the oldest segments are dropped. The ingest key is never written to disk.
For zero-code instrumentation see the Go instrumentation guide; for a plain OTel setup without the helper see the Go onboarding guide.