问题描述
我正在使用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 (将#修改为@)