【问题标题】:Apache Flink showing custom metrics in UI, but prometheus metrics reporter not scraping themApache Flink 在 UI 中显示自定义指标,但普罗米修斯指标报告器没有抓取它们
【发布时间】:2021-10-11 16:27:18
【问题描述】:

我正在通过 Prometheus Flink Metrics Reporter 向 prometheus 发送自定义应用程序指标。这些指标是正确创建的,因为我能够在 flink 仪表板中准确地看到它们。我配置了类似于 found here 的 prometheus 指标报告器。当我 curl 到 prometheus 端点(curl http://localhost:9090/api/v1/metrics)时,我只能看到集群指标,而不是我正在创建的自定义指标。我怀疑这个问题与我如何配置 Prometheus Flink Metrics Reporter 有关,因为当我尝试访问 http://localhost:9090 时,没有 UI,只有上面提到的集群指标列表。

用于创建指标的 flink 作业代码(在 Flink UI 中可见):

this.anomalyCounter = getRuntimeContext.getMetricGroup.addGroup("metric1").counter("counter")

flink-conf.yaml:

metrics.reporters: prom
metrics.reporter.prom.class: org.apache.flink.metrics.prometheus.PrometheusReporter
metrics.reporter.prom.port: 9090

promethus.yml:

scrape_configs:
  - job_name: 'flink'
    static_configs:
      - targets: ['localhost:9090']

我在配置中有什么遗漏吗?为什么我的集群指标到达 prometheus 而不是我的自定义指标?

【问题讨论】:

标签: apache-flink prometheus metrics


【解决方案1】:

您好 @sarvad123 可能(取决于您的 Flink 版本)您应该在 /lib 文件夹中添加 flink-metrics-prometheus-{version}.jar

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-12
    • 1970-01-01
    • 2020-01-10
    • 2020-11-12
    • 2020-11-10
    • 2021-02-13
    • 2023-02-01
    相关资源
    最近更新 更多