Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
OpenTelemetry (CNCF) is the standard way for apps to send traces, metrics and logs. Apps use an OTel SDK or auto-instrumentation and send OTLP (gRPC 4317, HTTP 4318) to the Collector. The Collector has receivers (otlp, prometheus, filelog, hostmetrics), processors (batch, memory_limiter, attributes, filter, k8sattributes) and exporters (otlp to Tempo/Jaeger, prometheusremotewrite, loki, azuremonitor), joined in pipelines.
otelcol-contrib is the build with most components. In Kubernetes, use the OpenTelemetry Operator or the Helm chart.
Zo schrijf je het
otelcol-contrib --config=FILE
otelcol-contrib validate --config=FILEBelangrijkste delen
Config sections
receivers- Where data comes in (otlp, prometheus, filelog, hostmetrics).
processors- Change data (batch, memory_limiter, attributes, filter).
exporters- Where data goes (otlp, otlphttp, prometheusremotewrite, debug).
extensions- health_check, pprof, zpages, auth.
service.pipelines- traces / metrics / logs: receivers → processors → exporters.
Opties 4
Meest gebruikt
Command flags
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1A simple gateway config
cat /etc/otelcol-contrib/config.yaml receivers: otlp: protocols: grpc: { endpoint: 0.0.0.0:4317 } http: { endpoint: 0.0.0.0:4318 } processors: memory_limiter: { check_interval: 1s, limit_percentage: 80, spike_limit_percentage: 20 } batch: {} exporters: otlp/tempo: { endpoint: tempo.monitoring.svc:4317, tls: { insecure: true } } prometheusremotewrite: { endpoint: http://prometheus.monitoring.svc:9090/api/v1/write } debug: { verbosity: basic } service: pipelines: traces: { receivers: [otlp], processors: [memory_limiter, batch], exporters: [otlp/tempo] } metrics: { receivers: [otlp], processors: [memory_limiter, batch], exporters: [prometheusremotewrite] }2Validate and start
otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml systemctl restart otelcol-contrib3Run in a container
podman run -d --name otelcol -p 4317:4317 -p 4318:4318 -v ./config.yaml:/etc/otelcol-contrib/config.yaml:Z docker.io/otel/opentelemetry-collector-contrib:0.112.04Send a test trace with telemetrygen
telemetrygen traces --otlp-insecure --otlp-endpoint localhost:4317 --traces 55Point an app at the collector
6Collect host metrics too
cat hostmetrics.yaml receivers: hostmetrics: collection_interval: 30s scrapers: { cpu: {}, memory: {}, filesystem: {}, network: {} }7Remove sensitive attributes
cat redact.yaml processors: attributes/redact: actions: - { key: http.request.header.authorization, action: delete } - { key: user.email, action: hash }8Install on Kubernetes with Helm
9Check health
curl -s http://localhost:13133/10List the components of your build
otelcol-contrib components | head -40
Niets past bij dit filter.
Let op
- Always put
memory_limiterfirst andbatchlast in the processor list. - Traces can carry personal data and tokens in attributes; redact them in the collector.
- Do not expose 4317/4318 to the internet without auth (use the auth extensions or a gateway).
Bestanden
/etc/otelcol-contrib/config.yaml- Configuration (RPM/DEB packages).
Tips om te onthouden
- Agent (on each node) + gateway (central) is the common setup.
Exitcodes
0 | Success. |
1 | Error (invalid config). |