Skip to content

OpenTelemetry Collector

This guide configures logs, traces, metrics. Replace YOUR_INGEST_KEY with your key on your server, never in a public example.

Install the Collector contrib distribution. This example binds local OTLP/HTTP only. Bind to a private interface with access controls if other hosts must send to it.

collector.yaml
receivers:
otlp:
protocols:
http:
endpoint: 127.0.0.1:4318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 256
spike_limit_mib: 64
resource:
attributes:
- {key: service.name, value: "checkout", action: upsert}
- {key: deployment.environment.name, value: "production", action: upsert}
batch:
send_batch_size: 256
send_batch_max_size: 512
timeout: 1s
exporters:
otlphttp/siteqwality:
endpoint: https://otlp.siteqwality.com
headers:
Authorization: "Bearer YOUR_INGEST_KEY"
compression: gzip
sending_queue: {enabled: true, queue_size: 1000}
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 30s, max_elapsed_time: 300s}
service:
pipelines:
logs:
receivers: [otlp]
processors: [memory_limiter, resource, batch]
exporters: [otlphttp/siteqwality]
traces:
receivers: [otlp]
processors: [memory_limiter, resource, batch]
exporters: [otlphttp/siteqwality]
metrics:
receivers: [otlp]
processors: [memory_limiter, resource, batch]
exporters: [otlphttp/siteqwality]

A memory queue survives transient failures, not process loss. Use the file_storage extension and a persistent sending queue for host restart durability. Keep batches within the receiver byte limits; record counts alone do not bound large records.

Terminal window
otelcol-contrib --config=collector.yaml

3. Point your application at the local Collector

Section titled “3. Point your application at the local Collector”

No cloud ingest key belongs in the application when the Collector owns it. Enable the relevant SDK exporters. The Collector appends /v1/logs, /v1/traces and /v1/metrics to its cloud endpoint.

Terminal window
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318

Open Logs, Traces or Metrics. New data usually shows up within a minute, and a page that says it is waiting for data switches to your data on its own. Nothing arriving? See what each status code means in failure handling.

Store the key in your platform secret mechanism, rotate it when exposed and remove test keys. Set a stable service.name and deployment.environment.name; avoid user IDs or unbounded values in metric labels. Prefer a persistent queue, bounded retries and exporter failure monitoring. Review redaction and processors before increasing traffic.