Skip to content

Go

Collect Go runtime and HTTP metrics from your services and get curated dashboards and alerts for them with a single import.

Go apps instrumented with the OpenTelemetry SDK export their metrics over OTLP to your LeanSignal agent gateway (one per cluster or environment) — never to a remote or third-party endpoint. The gateway keeps full fidelity locally and forwards only the demanded subset to your central dataplane. This integration covers the Go runtime (memory, goroutines, GC goal, scheduler latency, GOMAXPROCS/GOGC) plus HTTP server request metrics from otelhttp.

Metric names follow the standard OTLP → Prometheus normalization (dots become underscores, unit/_total suffixes are added), so go.goroutine.count becomes go_goroutine_count and http.server.request.duration becomes http_server_request_duration_seconds. The demands below are built against those names.

  • A LeanSignal agent gateway deployed and connected — one per cluster or environment. If you haven’t deployed it yet, follow Install the agent (source: LeanSignal/leansignal-agent). It should show as Connected under Agents in the LeanSignal app.
  • Network reachability to the gateway’s OTLP port4317 (gRPC) or 4318 (HTTP). See Agent configuration.
  • Your Go app instrumented with the OpenTelemetry SDK, exporting metrics over OTLP to the gateway — configured in Setup.
  • Editor or admin role in the LeanSignal app (importing a demand creates dashboards and alert rules).

Add the runtime, OTLP-metric, and HTTP instrumentation packages, then point the SDK at your LeanSignal agent gateway (OTLP gRPC :4317 / HTTP :4318) — not a SaaS endpoint.

Terminal window
go get go.opentelemetry.io/contrib/instrumentation/runtime
go get go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc
go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
Terminal window
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<gateway-host>:4317"
export OTEL_EXPORTER_OTLP_PROTOCOL="grpc" # or http/protobuf -> :4318
export OTEL_SERVICE_NAME="my-go-service"
export OTEL_SEMCONV_STABILITY_OPT_IN="http" # emit stable http.server.request.duration

Wire up the meter provider and start the runtime producer:

exp, _ := otlpmetricgrpc.New(context.Background()) // reads OTEL_EXPORTER_OTLP_ENDPOINT
mp := sdkmetric.NewMeterProvider(
sdkmetric.WithReader(sdkmetric.NewPeriodicReader(exp)),
// The second reader enables go.schedule.duration:
sdkmetric.WithReader(sdkmetric.NewPeriodicReader(exp, sdkmetric.WithProducer(runtime.NewProducer()))),
)
otel.SetMeterProvider(mp)
_ = runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
// Instrument your HTTP server:
handler := otelhttp.NewHandler(mux, "server")

Go has no zero-code agent, so each signal is wired in code against the same gateway endpoint:

  • Traces — set up a TracerProvider with an OTLP exporter and wrap handlers/clients with otelhttp (or your framework’s middleware); the net/http instrumentation that feeds the metrics above emits spans from the same wrappers.
  • Logs — bridge slog with otelslog (or otelzap for zap) over an OTLP LoggerProvider; or keep logging to stdout and ship files with a collector or shipper instead.

See the Go OpenTelemetry docs.

Go ships as a ready-made demand in three variants. You don’t copy any JSON — in the LeanSignal app go to Demands, press the ˅ arrow on the Add Demand button (the arrow opens the import menu), choose Import from catalog…, and pick the variant. Each variant below lists the slug that identifies its published bundle. See Integrations for the full import flow.

The variants are nested — Standard is a superset of Essential, Extended a superset of Standard. Pick whichever is closest to what you need and treat it as a starting point: after import everything is a normal, editable copy, so retune thresholds, add or drop panels, and adjust queries for your environment — your edits reshape the demand automatically. Start small and re-import a larger variant later if you outgrow it.

The golden signals. 1 dashboard · 4 panels · 3 alerts — traffic, errors, latency, and goroutines at a glance.

Import this variant from the catalog. Its demand slug:

Demand slug
golang-otel-demand-essential

Dashboard — HTTP request rate, HTTP 5xx error rate, HTTP request duration p95, and Live goroutines.

Alerts (3)

AlertSeverityFires when
High HTTP 5xx error ratecritical5xx ratio > 5% for 5m
High HTTP p95 latencywarningp95 latency > 1s for 5m
Goroutine count spikewarning> 10,000 goroutines for 10m

Review the bundle JSON →

Each variant imports one Go dashboard, its panels grouped into collapsible sections. Every dashboard carries an Instance filter (on the instance label), so one import covers the whole fleet — view every instance at once, or focus on one. Legends are sortable tables showing last/mean/max per series, so the outlier instance stands out. Dashboards are demand-driven: importing one tells your agents to forward exactly the timeseries its panels query, and nothing else. Panels are ordinary Perses panels — edit queries, add panels, or retune them after import, and your changes reshape the demand automatically.

Thresholds are conservative starting points — tune them to your workload.

Was this page helpful?