.net - OpenTelemetry 收集器导出到 Prometheus 不起作用
问题描述
所有,我正在尝试将 OpenTelemetry 收集器与 Prometheus 集成到 .Net 应用程序中。我在应用程序中使用 OTLP Exporter,并在同一系统上将 OpenTelemetry Collector 作为 Windows 服务运行。请找到以下我用于收集器的“config.yaml”
extensions:
health_check:
pprof:
endpoint: 0.0.0.0:1777
zpages:
endpoint: 0.0.0.0:55679
receivers:
otlp:
protocols:
grpc:
http:
prometheus:
config:
scrape_configs:
- job_name: 'otel-collector'
scrape_interval: 5s
static_configs:
- targets: [ 'localhost:55681' ]
processors:
batch:
exporters:
zipkin:
endpoint: "http://127.0.0.1:9411/api/v2/spans"
prometheus:
endpoint: "localhost:55681"
namespace: promexample
const_labels:
label1: value1
logging:
logLevel: debug
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging,zipkin]
metrics:
receivers: [otlp,prometheus]
processors: [batch]
exporters: [logging,prometheus]
extensions: [health_check, pprof, zpages]
这是'prometheus.yml'
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
- job_name: 'otel-collector'
scrape_interval: 10s
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:55681']
我没有看到导出到 Prometheus 的指标。我正在应用程序中以编程方式创建一些计数器,并在 Prometheus 中寻找相同的计数器。
请注意,我尝试将跟踪导出到 Zipkin 并且效果很好。
任何帮助是极大的赞赏。Prometheus UI 目标运行状况显示为“UP”,如下所示。
解决方案
推荐阅读
- r - Excel 错误:已删除记录 - 从 R 上传数据后已删除图表
- css - 离子 5 和固定上述部分的滚动内容的最佳解决方案是什么?
- javascript - 为什么 TypeScriptlang 中的“车辆”类型上不存在“颜色”的属性?
- flutter - AssetsAudioPlayer 只播放最后一个索引的音频
- angular - 如何拨打电话,如果api返回错误404,将打开模态
- python - 如何添加日期作为参数?
- css - 为什么在白色背景上更改 alpha 会产生与混合白色不同的结果?
- angular - 在同一个域名上托管 2 个 SPA 的正确方法是什么?
- php - 按列值对数据行进行分组并重组为关联多维数组
- php - 在 WP_Query 中获取 WooCommerce 订阅产品类型和特定类别