微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法将数据从开放式遥测收集器导出到普罗米修斯

如何解决无法将数据从开放式遥测收集器导出到普罗米修斯

我正在使用OTEL版本0.13.0和opentelemetry-collector将度量标准从go代码导出到prometheus。 这是我的docker-compose文件

version: "3.1"
services:
  otel-collector:
    image: otel/opentelemetry-collector:latest
    command: ["--config=/etc/otel-collector-config.yaml","--log-level=DEBUG"]
    volumes:
      - ./collector-config.yml:/etc/otel-collector-config.yaml
    ports:
      - "1888:1888"   
      - "8888:8888"   
      - "8889:8889" 
      - "55678:55678"       
      - "55680:55679"
  # Agent
  otel-agent:
    image: otel/opentelemetry-collector:latest
    command: ["--config=/etc/otel-agent-config.yaml","--log-level=DEBUG"]
    volumes:
      - ./otel-agent-config.yaml:/etc/otel-agent-config.yaml
    ports:
      - "1777:1777"   # pprof extension
      - "8887:8888"   # Prometheus metrics exposed by the agent
    depends_on:
      - otel-collector
  
  prometheus:
    container_name: prometheus
    image: prom/prometheus:latest
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"

这是收集器配置文件

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:55678
  prometheus:
    config:
      scrape_configs:
        - job_name: 'otel-collector'
          scrape_interval: 5s
          static_configs:
            - targets: [ '0.0.0.0:8889' ]

exporters:
  prometheus:
    endpoint: "0.0.0.0:8889"
    namespace: versionsvc

  logging:
    loglevel: debug

processors:
  batch:
  queued_retry:

service:
  pipelines:
    metrics:
      receivers: [otlp,prometheus]
      exporters: [logging,prometheus]
      processors: [batch,queued_retry]
 

当我通过代码发送以下指标时

counter := metric.Must(meter).NewFloat64Counter("hits",metric.WithDescription("Measure the total hits"))
    counter.Add(context.Background(),5)

otel-collector的终端日志中给出了一些特殊字符,如下所示-

otel-collector_1  | InstrumentationLibraryMetrics #0
otel-collector_1  | InstrumentationLibrary test-basic 
otel-collector_1  | Metric #0
otel-collector_1  | Descriptor:
otel-collector_1  |      -> Name: 
otel-collector_1  | hitsMeasure the total hits 
otel-collector_1  |      -> Description: 
otel-collector_1  |      -> Unit: �ɅtB��ɅtB!@
otel-collector_1  |      -> DataType: None

我无法理解以下字符,因此我认为这些度量标准不会成为普罗米修斯。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。