Sdnotify Extension
contrib
Maintainers: @VihasMakwana, @iypetrov
Source: opentelemetry-collector-contrib
Overview
Thesd_notify extension integrates the collector with the sd_notify(3) protocol.
When running under a Type=notify (or Type=notify-reload) systemd unit, the collector will:
- Send
READY=1once all pipelines have started. - Send
STOPPING=1when the process is shutting down after receivingSIGINTorSIGTERM, so systemd knows the shutdown is intentional. - (only for
Type=notify-reload) OnSIGHUPsendRELOADING=1(paired withMONOTONIC_USECas required bysd_notify(3)) so systemd’s state machine correctly reflects that a reload is in progress. The extension doesn’t itself drive a reload or cycle the process onSIGHUP. The OpenTelemetry Collector has its ownSIGHUPhandler that performs an in-process reload. - When systemd has set
WATCHDOG_USECfor the collector’s PID, sendWATCHDOG=1keep-alive notifications everyWATCHDOG_USEC / 2as recommended by sd_watchdog_enabled(3), for as long as the collector is running, so systemd can restart the process if it hangs.
It is recommended that a daemon sends a keep-alive notification message to the service manager every half of the time returned here.NOTE: When
$NOTIFY_SOCKET is not set the extension logs a warning and stays a no-op — it will never fail collector startup.
Configuration
The extension takes no configuration:Example systemd unit
Development
Unit and integration tests are tagged with//go:build linux, because systemd
is primarily used in Linux. This means that if you try to run them, they will
be skipped if you use a non-Linux machine (MacOS, FreeBSD, Windows, etc.). To
overcome that you can remove the directives and run the tests locally. Keep in
mind that you need Docker installed on your machine in
order to run the integration tests, because they use Testcontainers.
Use the command below to run both unit and integration tests.
Last generated: 2026-10-05