← Projects

Project · Go · MIT

sdmetrics experimental

Connects Go and OpenTelemetry to systemd's metrics framework: publish metrics from a Go daemon the way systemd's own services do, and export every source on a host as OTLP.

shell
go get github.com/rossedman/sdmetrics@latest

systemd v260 added a metrics framework: a process becomes a metrics source by answering the io.systemd.Metrics Varlink interface on a socket under /run/systemd/report/. sdmetrics fills the two gaps around it.

  • A provider SDK so a Go daemon can publish gauges, counters and labeled metrics in a few lines, readable by systemd-report. Updates are lock-free and allocation-free.
  • Bridges that publish an existing Prometheus registry or OpenTelemetry reader without re-instrumenting.
  • sdmetrics-exporter, a static binary with a hardened unit that scrapes every source on a host and pushes OTLP.
  • A Collector receiver, systemdreport, for fleets that already run otelcol.

Built on sdvarlink. It needs systemd v260 or newer.