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:latest 
      2
      
              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-service 
      3
      
        labels:
          component: otel-collector
      spec:
        type: ClusterIP
        ports:
        - name: otlp-grpc
          port: 4317
          targetPort: 4317
        selector:
          component: otel-collector
      Copy to Clipboard Toggle word wrap

      1
      使用第三方系统所需的导出器替换 debug
      2
      将镜像替换为带有第三方系统所需导出器所需的 OpenTelemetry Collector 版本。
      3
      红帽构建的 OpenTelemetry Collector CR 中使用服务名称来配置 OTLP 导出器。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat