Skip to content

opentelemetry-collector

Settings-generated configurations allocate free ports for the health_check extension, OTLP gRPC/HTTP receivers, and internal Prometheus metrics readers. Configured ports are allocation bases, not guaranteed listening ports. This lets collectors in separate devenv projects run concurrently.

Use resolved ports when configuring applications or scrapers:

{ config, ... }:
{
env.OTEL_EXPORTER_OTLP_ENDPOINT =
"http://localhost:${toString config.processes.opentelemetry-collector.ports.http.value}";
}

The standard port names are health (base 13133), metrics (8888), grpc (4317), and http (4318). Only configured, enabled listeners are allocated. Named receivers such as otlp/app use otlp-app-grpc and otlp-app-http. The first allocated internal Prometheus reader uses metrics; additional readers use metrics-<zero-based reader index>. An omitted Prometheus reader port uses 8888. Explicit reader lists replace the default reader; push exporters are unchanged.

Bind hosts and other collector settings are preserved. Disabled protocols, disabled internal metrics, Unix sockets, port zero, and templated endpoints are not automatically allocated. Other receivers, extensions, and listening exporters remain manually configured.

configFile overrides are passed through unchanged, without inferred port allocations. When generating raw YAML in Nix, declare process ports and reference their resolved values explicitly. Also override processes.opentelemetry-collector.ready to match the raw file’s health endpoint, or set it to lib.mkForce null if health checks are disabled.

Whether to enable opentelemetry-collector.

Type: boolean

Default:

false

Example:

true

Declared by:

The OpenTelemetry Collector package to use

Type: package

Default:

pkgs.opentelemetry-collector-contrib

Declared by:

services.opentelemetry-collector.configFile

Section titled “services.opentelemetry-collector.configFile”

Override the configuration file used by OpenTelemetry Collector. By default, a configuration is generated from services.opentelemetry-collector.settings.

Raw configuration files are not rewritten and their ports are not automatically allocated. Declare process ports and reference their resolved values when generating a raw file, and override the readiness probe to match its health endpoint.

If overriding, enable the health_check extension to allow the readiness probe to check whether the Collector is ready. Otherwise, disable the readiness probe by setting processes.opentelemetry-collector.ready = lib.mkForce null;.

Type: null or absolute path

Default:

null

Example:

pkgs.writeTextFile { name = "otel-config.yaml"; text = "..."; }

Declared by:

OpenTelemetry Collector configuration. Literal TCP ports in the health_check extension, OTLP receivers, and internal Prometheus metrics readers are used as allocation bases. The generated configuration uses the resolved values from processes.opentelemetry-collector.ports. Refer to https://opentelemetry.io/docs/collector/configuration/ for more information on how to configure the Collector.

Type: open submodule of (YAML 1.1 value)

Default:

defaultSettings

Declared by: