![](/img/trans.png)
[英]Can't expose hystrix metrics to /actuator/prometheus after migrating application to Spring boot 2
[英]Can't expose Flink metrics to Prometheus
我試圖將 Flink 的內置指標公開給 Prometheus,但不知何故 Prometheus 無法識別目標 - JMX和PrometheusReporter 。
prometheus.yml
定義的抓取如下所示:
scrape_configs:
- job_name: node
static_configs:
- targets: ['localhost:9100']
- job_name: 'kafka-server'
static_configs:
- targets: ['localhost:7071']
- job_name: 'flink-jmx'
static_configs:
- targets: ['localhost:8789']
- job_name: 'flink-prom'
static_configs:
- targets: ['localhost:9249']
我的flink-conf.yml
有以下幾行:
#metrics.reporters: jmx, prom
metrics.reporters: jmx, prometheus
#metrics.reporter.jmx.factory.class: org.apache.flink.metrics.jmx.JMXReporterFactory
metrics.reporter.jmx.class: org.apache.flink.metrics.jmx.JMXReporter
metrics.reporter.jmx.port: 8789
metrics.reporter.prom.class: org.apache.flink.metrics.prometheus.PrometheusReporter
metrics.reporter.prom.port: 9249
但是,在運行WordCount時,兩個 Flink 目標都關閉了
java -jar target/flink-word-count.jar --input src/main/resources/loremipsum.txt
flink run target/flink-word-count.jar --input src/main/resources/loremipsum.txt
根據 Flink 文檔,我不需要 JMX 的任何額外依賴項以及為 Prometheus 報告器提供的flink/lib/
提供的flink-metrics-prometheus-1.10.0.jar
的flink/lib/
。
我究竟做錯了什么? 有什么不見了?
我相信,那項特定的工作將很快完成。 一旦設置工作,可能沒有有趣的指標,因為作業運行的時間不夠長,無法顯示任何內容。
當您使用迷你集群(如java -jar ...
)運行時,不會加載flink-conf.yaml
文件(除非您在工作中做了一些特別的事情來加載它)。 另請注意,此文件通常具有.yaml
擴展名; 如果使用.yml
代替,我不確定它是否.yml
。
您可以檢查點動管理器和任務管理器日志以確保正在加載報告器。
FWIW,上次我這樣做時我使用了這個設置,這樣我就可以從多個進程中抓取:
# flink-conf.yaml
metrics.reporters: prom
metrics.reporter.prom.class: org.apache.flink.metrics.prometheus.PrometheusReporter
metrics.reporter.prom.port: 9250-9260
# prometheus.yml
scrape_configs:
- job_name: 'flink'
static_configs:
- targets: ['localhost:9250', 'localhost:9251']
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.