Skip to content

Use an OpenTelemetry Collector

An OpenTelemetry Collector sits between CredenceStack and your platforms. Send CredenceStack's spans to it once; it batches them, limits its own memory, and forwards them to as many backends as you configure (fan-out). Platform keys then live in the Collector's configuration, not on every machine that runs CredenceStack.

CredenceStack's side

credencestack run -p payments --agent my_agent:policy --otel \
  (OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.internal:4318)      # OTLP/HTTP
# or: (OTEL_EXPORTER_OTLP_PROTOCOL=grpc) (OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.internal:4317)

A sample configuration: two platforms at once

This configuration receives OTLP on both ports and forwards every trace to two OTLP/HTTP backends. Replace the endpoints and header names with the values from each platform's guide; keep the keys in environment variables, which the Collector expands with ${env:NAME}.

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  memory_limiter:            # first: refuse data before the Collector runs out of memory
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 20
  batch:                     # then batch, so each backend gets fewer, larger requests
    timeout: 5s
    send_batch_size: 512

exporters:
  otlphttp/platform_a:
    endpoint: https://otlp.platform-a.example.com
    headers:
      authorization: "Bearer ${env:PLATFORM_A_TOKEN}"
  otlphttp/platform_b:
    endpoint: https://otlp.platform-b.example.com
    headers:
      x-api-key: "${env:PLATFORM_B_KEY}"

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, batch]
      exporters: [otlphttp/platform_a, otlphttp/platform_b]

Run it with the Collector "contrib" distribution, which includes the exporters most platforms need:

docker run --rm -p 4317:4317 -p 4318:4318 \
  -e PLATFORM_A_TOKEN -e PLATFORM_B_KEY \
  -v "$PWD/collector.yaml:/etc/otelcol-contrib/config.yaml:ro" \
  otel/opentelemetry-collector-contrib:0.115.0

The image tag is the one CredenceStack's integration test uses; use a current release. Check the processor and exporter options against the Collector documentation for your version.

Headers and secrets

  • Put keys in the Collector's environment and reference them as ${env:NAME}; never commit them in the YAML.
  • On the CredenceStack side, headers come only from OTEL_EXPORTER_OTLP_HEADERS: there is no flag, so secrets never reach shell history or the process list. In GitHub Actions, pass them through the action's otel-headers-secret input, which masks them (CI).
  • Use TLS between CredenceStack and the Collector when they are on different hosts.

Filtering at the Collector

Because CredenceStack's spans carry credencestack.source=harness, a Collector filter or routing processor can send them to one backend and the framework's own spans elsewhere. See the Collector's filter and routing components for your version.

Content and privacy

The Collector forwards what it receives. With content capture off (the default) no prompts, arguments or results reach it; confidential content never does. If you turn capture on, every backend in the pipeline receives the redacted, size-capped content of public scenarios.