Go
<!-- status: ga language: go -->
Go: zero-code instrumentation
Go has no runtime to hook, so zero-code means eBPF: the OpenTelemetry Go auto-instrumentation (opentelemetry-go-instrumentation) attaches to a running binary on Linux and records spans for net/http, database/sql, gRPC and Kafka. It needs a privileged process next to the service (CAP_SYS_PTRACE and CAP_BPF, or root); if that is not possible use the SDK route in the onboarding guide for Go.
Create a project, then an ingestion key (
wti_...) with theingest:tracesscope. The key is shown once.Point the instrumentation at the gateway and pass the key in the
x-watchtower-keyheader:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.example.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS=x-watchtower-key=wti_YOUR_KEY
export OTEL_SERVICE_NAME=my-service
export OTEL_GO_AUTO_TARGET_EXE=/usr/local/bin/my-serviceRun the released
otel-go-instrumentationbinary (from the opentelemetry-go-instrumentation releases) as root on the same host or in the same pid namespace, with the variables above:
sudo -E ./otel-go-instrumentationSend one request to the service, then open the project's onboarding screen: it turns green when the first span arrives.