Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

otelcol

The OpenTelemetry Collector receives traces, metrics and logs (OTLP and more), processes them and exports them to any backend.

Niveau
DevSecOps-service
Groep
Monitoring en logging
Root nodig
Voor wijzigingen
Pakket
otelcol-contrib
Ook
otelcol-contrib, opentelemetry-collector

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=FILE

Belangrijkste 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

--config=FILE
Config file (can repeat; also env:, yaml: sources).
validate
Check the config and exit.
components
List built-in components.
--feature-gates=NAME
Turn on new features.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 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] }
  2. 2Validate and start

    otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml
    systemctl restart otelcol-contrib
  3. 3Run 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.0
  4. 4Send a test trace with telemetrygen

    telemetrygen traces --otlp-insecure --otlp-endpoint localhost:4317 --traces 5
  5. 5Point an app at the collector

    export OTEL_SERVICE_NAME=shop-api
    export OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4318
    export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod
    opentelemetry-instrument python app.py
  6. 6Collect host metrics too

    cat hostmetrics.yaml
    receivers:
      hostmetrics:
        collection_interval: 30s
        scrapers: { cpu: {}, memory: {}, filesystem: {}, network: {} }
  7. 7Remove sensitive attributes

    cat redact.yaml
    processors:
      attributes/redact:
        actions:
          - { key: http.request.header.authorization, action: delete }
          - { key: user.email, action: hash }
  8. 8Install on Kubernetes with Helm

    helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
    helm install otel open-telemetry/opentelemetry-collector -n monitoring --set mode=daemonset --set image.repository=otel/opentelemetry-collector-contrib
  9. 9Check health

    curl -s http://localhost:13133/
  10. 10List the components of your build

    otelcol-contrib components | head -40

Let op

  • Always put memory_limiter first and batch last 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

0Success.
1Error (invalid config).