Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 400
batch: {}
exporters:
otlp/jaeger:
endpoint: jaeger.example.com:4317
tls:
insecure: true
debug:
verbosity: basic
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp/jaeger, debug]otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml
systemctl restart otelcol-contribStep by step
- Run a backend — Jaeger v2 in one container (UI on port 16686, OTLP on 4317/4318); see the Jaeger guide.
- Run the Collector (quick answer) — apps send to it, not straight to the backend: it batches, limits memory, can drop health checks, and lets you change the backend without touching apps.
- Instrument the app without code changes — Python example (Java: the
-javaagentjar; Node.js:@opentelemetry/auto-instrumentations-node):
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a install
export OTEL_SERVICE_NAME=checkout-api
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel.example.com:4318
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
opentelemetry-instrument python app.pyThe agent creates spans for incoming HTTP requests, database calls and outgoing HTTP calls.
- Send a few requests and watch the Collector log — the
debugexporter prints a line per batch of spans:
for i in $(seq 20); do curl -s -o /dev/null http://localhost:8000/checkout; done
journalctl -u otelcol-contrib -n 20- Read the trace — Jaeger UI → service
checkout-api→ Find traces. The waterfall shows each span; the longest bar is your slow step. - Connect services — every service needs instrumentation; the trace ID travels in the W3C
traceparentHTTP header. Proxies and gateways must pass it on. - Sample in production — keep 10 % of traces:
- Add context —
OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,service.version=1.4.2so you can filter by version after a deploy.
Check that it worked
otelcol-contrib validate ends without errors; the Collector log shows spans arriving; curl -s http://jaeger.example.com:16686/api/services lists checkout-api; a trace in the UI shows the HTTP span with child spans for the database.
Common problems
| Problem | Cause | Fix |
|---|---|---|
| No traces at all | Port and protocol do not match (4317 = gRPC, 4318 = HTTP). | Set OTEL_EXPORTER_OTLP_PROTOCOL to match the port. |
| Each service shows separate traces | traceparent is lost (proxy, queue, missing instrumentation). | Instrument all services; let the proxy pass the header. |
| Collector is killed (OOM) | No memory limit, big bursts. | memory_limiter first in the pipeline; more memory. |
Exporter connection refused | Backend address or TLS setting wrong. | Check endpoint; tls.insecure only inside a private network. |
| Too much data / cost | 100 % sampling. | Head sampling (ratio) or tail sampling in the Collector. |
| Secrets in span attributes | SQL statements or headers recorded. | Turn off statement capture; a processor to delete attributes. |
Go further
- Command pages: otelcol, curl.
- Next how-tos: Ship logs with Fluent Bit, Load test an API with k6, Find out why a server is slow, Monitor a Linux server with Prometheus.
- Learn it: Observability tools at work — OpenTelemetry, Observability services — Collector. Full guides: OpenTelemetry Collector, Jaeger.
1Why send spans to a Collector instead of straight to Jaeger?
The Collector batches and limits data, can filter it, and lets you change the backend without changing every app.
2How does one trace cross several services?
The trace ID travels in the W3C traceparent header; each instrumented service continues the same trace.