Skip to main content

Sdnotify Extension

Status Available in: contrib Maintainers: @VihasMakwana, @iypetrov Source: opentelemetry-collector-contrib

Overview

The sd_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=1 once all pipelines have started.
  • Send STOPPING=1 when the process is shutting down after receiving SIGINT or SIGTERM, so systemd knows the shutdown is intentional.
  • (only for Type=notify-reload) On SIGHUP send RELOADING=1 (paired with MONOTONIC_USEC as required by sd_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 on SIGHUP. The OpenTelemetry Collector has its own SIGHUP handler that performs an in-process reload.
  • When systemd has set WATCHDOG_USEC for the collector’s PID, send WATCHDOG=1 keep-alive notifications every WATCHDOG_USEC / 2 as 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