8.3. 将遥测数据转发到第三方系统
OpenTelemetry Collector 通过 OpenTelemetry 协议(OTLP)使用 OTLP 导出数据,通过 gRPC 或 HTTP 传输实现。如果您需要将遥测数据转发到第三方系统,且不支持红帽构建的 OpenTelemetry 中的 OTLP 或其他支持的协议,则您可以通过 OTLP 接收遥测数据,并使用自定义导出器将其导出到第三方系统。
警告
红帽不支持自定义部署。
先决条件
- 您已开发了自己的不支持的自定义导出器,该导出器可以通过 OTLP 将遥测数据导出到第三方系统。
流程
通过 OperatorHub 或手动部署自定义收集器:
- 如果您的第三方系统支持它,请使用 OperatorHub 部署自定义 Collector。
使用配置映射、部署和服务手动部署自定义 Collector。
自定义 Collector 部署示例
apiVersion: v1 kind: ConfigMap metadata: name: custom-otel-collector-config data: otel-collector-config.yaml: | receivers: otlp: protocols: grpc: exporters: debug: {} prometheus: service: pipelines: traces: receivers: [otlp] exporters: [debug]1 --- apiVersion: apps/v1 kind: Deployment metadata: name: custom-otel-collector-deployment spec: replicas: 1 selector: matchLabels: component: otel-collector template: metadata: labels: component: otel-collector spec: containers: - name: opentelemetry-collector image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest2 command: - "/otelcol-contrib" - "--config=/conf/otel-collector-config.yaml" ports: - name: otlp containerPort: 4317 protocol: TCP volumeMounts: - name: otel-collector-config-vol mountPath: /conf readOnly: true volumes: - name: otel-collector-config-vol configMap: name: custom-otel-collector-config --- apiVersion: v1 kind: Service metadata: name: custom-otel-collector-service3 labels: component: otel-collector spec: type: ClusterIP ports: - name: otlp-grpc port: 4317 targetPort: 4317 selector: component: otel-collector