跳至正文
Wener Notes

OpenTelemetry Collector

约 2 分钟阅读
text
┌─────────────────────────────────────────────────┐
│          OpenTelemetry Collector                │
│                                                 │
│  ┌──────────┐   ┌──────────┐   ┌──────────┐     │
│  │ Receivers│──>│Processors│──>│ Exporters│     │
│  └──────────┘   └──────────┘   └──────────┘     │
│       ^              │               │          │
│       │              │               v          │
│  ┌────┴─────┐   ┌───-┴───┐    ┌──────────┐      │
│  │Extensions│   │Pipeline│    │  Backend │      │
│  └──────────┘   └────────┘    └──────────┘      │
└─────────────────────────────────────────────────┘
bash
# https://opentelemetry.io/docs/collector/installation/

OTEL_VERSION="0.137.0"

# Linux AMD64
curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTEL_VERSION}/otelcol-contrib_${OTEL_VERSION}_linux_amd64.tar.gz
tar -xzf otelcol-contrib_${OTEL_VERSION}_linux_amd64.tar.gz
sudo mv otelcol-contrib /usr/local/bin/

# macOS ARM64
curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTEL_VERSION}/otelcol-contrib_${OTEL_VERSION}_darwin_arm64.tar.gz
tar -xzf otelcol-contrib_${OTEL_VERSION}_darwin_arm64.tar.gz
mv otelcol-contrib ~/bin/

# Docker
# otel/opentelemetry-collector-contrib:0.137.0
# otel/opentelemetry-collector:1.43.0

otelcol-contrib --config otel.config.yaml validate

组件类型

Receivers

接收遥测数据的组件

Protocols:

  • otlp - OpenTelemetry Protocol (gRPC/HTTP)
  • jaeger - Jaeger traces
  • zipkin - Zipkin traces
  • prometheus - Prometheus metrics

System:

  • hostmetrics - 主机指标 (CPU, 内存, 磁盘, 网络)
  • filelog - 文件日志
  • journald - systemd journal
  • syslog - Syslog 协议

Application:

  • kafka - Kafka 消息
  • fluentforward - Fluentd/Fluent Bit
  • statsd - StatsD metrics

Processors

处理和转换遥测数据

Core Processors:

  • batch - 批量处理,减少请求数
  • memory_limiter - 内存限制保护
  • resourcedetection - 自动检测资源属性
  • attributes - 添加/删除/更新属性
  • filter - 过滤数据
  • transform - 数据转换

Advanced:

  • tail_sampling - 尾部采样
  • span - Span 处理
  • metricstransform - Metrics 转换
  • resource - Resource 处理

Exporters

发送遥测数据到后端系统

OpenTelemetry:

  • otlp - OTLP gRPC
  • otlphttp - OTLP HTTP

Tracing:

  • jaeger - Jaeger
  • zipkin - Zipkin
  • datadog - Datadog APM

Metrics:

  • prometheus - Prometheus
  • prometheusremotewrite - Prometheus Remote Write
  • influxdb - InfluxDB

Logging:

  • loki - Grafana Loki
  • elasticsearch - Elasticsearch
  • splunk_hec - Splunk HEC

Storage:

  • kafka - Kafka
  • file - 文件系统

Cloud:

  • awsxray - AWS X-Ray
  • awsemf - AWS CloudWatch EMF
  • googlecloud - Google Cloud
  • azuremonitor - Azure Monitor

Extensions

提供额外功能的组件

  • health_check - 健康检查 /health
  • pprof - Go profiling
  • zpages - 调试页面
  • basicauth - 基础认证
  • bearertokenauth - Bearer Token 认证

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

GitHub3 条
其他外链2 条
最近更新commit 2e88277编辑