هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
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.
طريقة الكتابة
otelcol-contrib --config=FILE
otelcol-contrib validate --config=FILEالأجزاء الرئيسية
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.
الخيارات 4
الأكثر استخدامًا
Command flags
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع 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
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- 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).
الملفات
/etc/otelcol-contrib/config.yaml- Configuration (RPM/DEB packages).
نصائح للحفظ
- Agent (on each node) + gateway (central) is the common setup.
رموز الخروج
0 | Success. |
1 | Error (invalid config). |