Skip to content

Collector pipelines

The OpenTelemetry Collector's configuration is deploy/otel-collector/config.yaml, mounted read-only into the otel-collector service (Observability). Values such as ${env:STACKR_ENVIRONMENT} are read from the service's environment, which compose.yaml sets from .env.

Pipelines

Pipeline Receivers Processors Exporters
traces otlp memory_limiter, resource/environment, transform/tenant, batch ${env:STACKR_TRACES_EXPORTERS}: set by make up from the profiles
metrics otlp memory_limiter, resource/environment, transform/tenant, batch otlp_http/prometheus
logs otlp memory_limiter, resource/environment, transform/tenant, batch otlp_http/loki

The traces pipeline's exporters come from STACKR_TRACES_EXPORTERS, which make up sets from the profiles: [otlp_grpc/tempo, otlp_http/langfuse] when the langfuse profile runs, and [otlp_grpc/tempo] when it doesn't. Compose's default, for plain docker compose, is both.

Components

Receivers

Receiver Protocol Listens on Notes
otlp grpc 0.0.0.0:4317
otlp http 0.0.0.0:4318 CORS from http://localhost:*, http://127.0.0.1:*

Processors

Processor Settings
memory_limiter {check_interval: 1s, limit_percentage: 80, spike_limit_percentage: 25}
resource/environment {attributes: [{key: deployment.environment.name, value: '${env:STACKR_ENVIRONMENT}', action: insert}]}
transform/tenant {error_mode: ignore, trace_statements: ['set(span.attributes["tenant.id"], span.attributes["artifactr.tenant.id"]) where span.attributes["artifactr.tenant.id"] != nil', 'set(span.attributes["tenant.id"], span.attributes["reflexr.tenant.id"]) where span.attributes["reflexr.tenant.id"] != nil', 'set(span.attributes["tenant.id"], span.attributes["relayr.tenant.id"]) where span.attributes["relayr.tenant.id"] != nil'], metric_statements: ['set(datapoint.attributes["tenant.id"], datapoint.attributes["artifactr.tenant.id"]) where datapoint.attributes["artifactr.tenant.id"] != nil', 'set(datapoint.attributes["tenant.id"], datapoint.attributes["reflexr.tenant.id"]) where datapoint.attributes["reflexr.tenant.id"] != nil', 'set(datapoint.attributes["tenant.id"], datapoint.attributes["relayr.tenant.id"]) where datapoint.attributes["relayr.tenant.id"] != nil'], log_statements: ['set(log.attributes["tenant.id"], log.attributes["artifactr.tenant.id"]) where log.attributes["artifactr.tenant.id"] != nil', 'set(log.attributes["tenant.id"], log.attributes["reflexr.tenant.id"]) where log.attributes["reflexr.tenant.id"] != nil', 'set(log.attributes["tenant.id"], log.attributes["relayr.tenant.id"]) where log.attributes["relayr.tenant.id"] != nil']}
batch {}

Exporters

Exporter Endpoint Sends Headers
otlp_grpc/tempo ${env:TEMPO_ADDRESS:-tempo}:4317 OTLP gRPC, without TLS
otlp_http/prometheus http://${env:PROMETHEUS_ADDRESS:-prometheus}:9090/api/v1/otlp OTLP HTTP, without TLS
otlp_http/loki http://${env:LOKI_ADDRESS:-loki}:3100/otlp OTLP HTTP, without TLS
otlp_http/langfuse http://${env:LANGFUSE_ADDRESS:-langfuse-web}:3000/api/public/otel OTLP HTTP, without TLS Authorization: Basic ${env:LANGFUSE_OTLP_AUTH}, x-langfuse-ingestion-version: 4

Extensions

Extension Settings
health_check {endpoint: '0.0.0.0:13133'}

The Collector's own telemetry

Signal Settings
metrics {level: detailed, readers: [{pull: {exporter: {prometheus: {host: 0.0.0.0, port: 8888}}}}]}
logs {level: info}

LANGFUSE_OTLP_AUTH is base64 of the Langfuse project's public and secret keys, which make env derives. Prometheus scrapes the Collector's own metrics on port 8888 for the Collector health dashboard; neither 8888 nor the health check's 13133 is published.

The file

The whole file: deploy/otel-collector/config.yaml
# The OpenTelemetry Collector: every application, and the LiteLLM proxy, sends
# OTLP here, and the Collector fans it out:
#   traces  -> Tempo, and Langfuse when the langfuse profile runs
#   metrics -> Prometheus, through its OTLP receiver; portalr reads them
#              through prom-label-proxy
#   logs    -> Loki, through its OTLP endpoint
# See docs/architecture.md and ADR-0007. Each backend's address is Compose's
# name by default, and its name in the AWS recipe's namespace there (ADR-0034).

extensions:
  health_check:
    endpoint: 0.0.0.0:13133

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
        cors:
          # Browser applications served from this machine can send OTLP too.
          allowed_origins: ["http://localhost:*", "http://127.0.0.1:*"]

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 25
  # Telemetry that doesn't say which environment it comes from is labelled
  # with STACKR_ENVIRONMENT (`local` by default).
  resource/environment:
    attributes:
      - key: deployment.environment.name
        value: ${env:STACKR_ENVIRONMENT}
        action: insert
  # One attribute names every signal's tenant, tenant.id, whichever library
  # recorded it as artifactr.tenant.id, reflexr.tenant.id or relayr.tenant.id,
  # so portalr filters Tempo, Loki and Prometheus on one name (lattice
  # RFC-0002). Loki keeps it as the tenant_id structured metadata, and
  # Prometheus as the tenant_id label.
  transform/tenant:
    error_mode: ignore
    trace_statements:
      - >-
        set(span.attributes["tenant.id"], span.attributes["artifactr.tenant.id"])
        where span.attributes["artifactr.tenant.id"] != nil
      - >-
        set(span.attributes["tenant.id"], span.attributes["reflexr.tenant.id"])
        where span.attributes["reflexr.tenant.id"] != nil
      - >-
        set(span.attributes["tenant.id"], span.attributes["relayr.tenant.id"])
        where span.attributes["relayr.tenant.id"] != nil
    metric_statements:
      - >-
        set(datapoint.attributes["tenant.id"], datapoint.attributes["artifactr.tenant.id"])
        where datapoint.attributes["artifactr.tenant.id"] != nil
      - >-
        set(datapoint.attributes["tenant.id"], datapoint.attributes["reflexr.tenant.id"])
        where datapoint.attributes["reflexr.tenant.id"] != nil
      - >-
        set(datapoint.attributes["tenant.id"], datapoint.attributes["relayr.tenant.id"])
        where datapoint.attributes["relayr.tenant.id"] != nil
    log_statements:
      - >-
        set(log.attributes["tenant.id"], log.attributes["artifactr.tenant.id"])
        where log.attributes["artifactr.tenant.id"] != nil
      - >-
        set(log.attributes["tenant.id"], log.attributes["reflexr.tenant.id"])
        where log.attributes["reflexr.tenant.id"] != nil
      - >-
        set(log.attributes["tenant.id"], log.attributes["relayr.tenant.id"])
        where log.attributes["relayr.tenant.id"] != nil
  batch: {}

exporters:
  otlp_grpc/tempo:
    endpoint: ${env:TEMPO_ADDRESS:-tempo}:4317
    tls:
      insecure: true
  otlp_http/prometheus:
    endpoint: http://${env:PROMETHEUS_ADDRESS:-prometheus}:9090/api/v1/otlp
    tls:
      insecure: true
  otlp_http/loki:
    endpoint: http://${env:LOKI_ADDRESS:-loki}:3100/otlp
    tls:
      insecure: true
  # Langfuse takes traces only, over OTLP HTTP. The ingestion version header
  # makes them visible as soon as they are written.
  otlp_http/langfuse:
    endpoint: http://${env:LANGFUSE_ADDRESS:-langfuse-web}:3000/api/public/otel
    headers:
      Authorization: Basic ${env:LANGFUSE_OTLP_AUTH}
      x-langfuse-ingestion-version: "4"

service:
  extensions: [health_check]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, resource/environment, transform/tenant, batch]
      # [otlp_grpc/tempo, otlp_http/langfuse], or Tempo alone when the
      # langfuse profile isn't running; set in compose.yaml and the Makefile.
      exporters: ${env:STACKR_TRACES_EXPORTERS}
    metrics:
      receivers: [otlp]
      processors: [memory_limiter, resource/environment, transform/tenant, batch]
      exporters: [otlp_http/prometheus]
    logs:
      receivers: [otlp]
      processors: [memory_limiter, resource/environment, transform/tenant, batch]
      exporters: [otlp_http/loki]
  telemetry:
    # The Collector's own metrics, scraped by Prometheus for the Collector
    # dashboard.
    metrics:
      level: detailed
      readers:
        - pull:
            exporter:
              prometheus:
                host: 0.0.0.0
                port: 8888
    logs:
      level: info