使用prometheuspushgateway报告flink度量时,从prometheus获取代码“200”

vaqhlq81  于 2021-06-26  发布在  Flink
关注(0)|答案(2)|浏览(1216)

当我使用flink-metrics-prometheus_2.11-1.10.0.jar向prometheus报告度量时,出现了以下错误,我想知道这个问题的原因以及如何解决它:

2020-04-20 15:32:17.940 [Flink-MetricRegistry-thread-1] WARN  org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter  - Failed to push metrics to PushGateway with jobName oceanus, groupingKey {}.
java.io.IOException: Response code from http://9.91.161.72:80/metrics/job/oceanus was 200
        at org.apache.flink.shaded.io.prometheus.client.exporter.PushGateway.doRequest(PushGateway.java:297)
        at org.apache.flink.shaded.io.prometheus.client.exporter.PushGateway.push(PushGateway.java:127)
        at org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter.report(PrometheusPushGatewayReporter.java:109)
        at org.apache.flink.runtime.metrics.MetricRegistryImpl$ReporterTask.run(MetricRegistryImpl.java:441)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
zbsbpyhn

zbsbpyhn1#

flink-metrics-prometheus-1.10.0.jar似乎包含了一个非常旧的prometheus客户机java版本(https://github.com/apache/flink/blob/master/flink-metrics/flink-metrics-prometheus/pom.xml#l79 , https://github.com/apache/flink/blob/release-1.9.1/pom.xml#l125 -0.3.0版本)。
恼人的警告“200OK”响应代码被修正为0.8.0(https://github.com/prometheus/client_java/blob/parent-0.8.0/simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/pushgateway.java#l316). 这个版本是从Flink1.11.0开始的(https://github.com/apache/flink/blob/release-1.11.0/pom.xml#l127).
因此,解决方案是将flink-metrics-prometheus-1.11.0.jar作为类路径的一部分。
不要担心flink版本的不兼容性,因为我使用的是flink 1.9.1和flink-metrics-prometheus-1.11.0.jar,一切都正常。我猜在Flink版本之间没有太多的变化

kmb7vmvb

kmb7vmvb2#

似乎最近处理回复的方式发生了变化。
我怀疑您需要将prometheus jar与服务器版本匹配,反之亦然。

相关问题