简体   繁体   English

使用 Jmx Exporter for Prometheus 缺少 Confluent Kafka Connect 指标

[英]Missing Confluent Kafka Connect Metrics using Jmx Exporter for Prometheus

I am not able to export "type=connector-metrics" metrics for Confluent connect service but other metrics are working fine.我无法为 Confluent 连接服务导出“type=connector-metrics”指标,但其他指标工作正常。

I am using prometheus exporter java agent to expose metrics from Confluent connect as shown below.我正在使用 prometheus 导出器 java 代理来公开来自 Confluent 连接的指标,如下所示。

Confluent Connect Configuration (/usr/bin/connect-distributed) Confluent 连接配置 (/usr/bin/connect-distributed)

export KAFKA_OPTS='-javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.12.0.jar=8093:/opt/prometheus/kafka-connect.yml' export KAFKA_OPTS='-javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.12.0.jar=8093:/opt/prometheus/kafka-connect.yml'

kafka-connect.yml kafka-connect.yml

   - pattern: kafka.connect<type=connector-metrics, connector=(.+)><>([a-z-]+)
     name: kafka_connector_$2
     labels:
       connector: "$1"
     help: "Kafka Connect JMX metric $1"
     type: GAUGE

With JMXTERM tool, i am able to see attributes for "type=connector-metrics"使用 JMXTERM 工具,我可以看到“type=connector-metrics”的属性

$>bean kafka.connect:connector=local-file-sink,type=connector-metrics
#bean is set to kafka.connect:connector=local-file-sink,type=connector-metrics
$>info
#mbean = kafka.connect:connector=local-file-sink,type=connector-metrics
#class name = org.apache.kafka.common.metrics.JmxReporter$KafkaMbean
# attributes
  %0   - connector-class (double, r)
  %1   - connector-type (double, r)
  %2   - connector-version (double, r)
  %3   - status (double, r)
#there's no operations
#there's no notifications
$>get connector-type
#mbean = kafka.connect:connector=local-file-sink,type=connector-metrics:
connector-type = sink;

$>get status
#mbean = kafka.connect:connector=local-file-sink,type=connector-metrics:
status = running;

Confluent Connect Version - 5.4汇合连接版本 - 5.4

Any suggestion to fix above issue?有什么建议可以解决上述问题吗?

I have been beating my head against the same issue.我一直在反对同样的问题。 I have since found a fix by upgrading to the latest jmx_exporter (0.13.0) and used the example connector exporter config file ( https://github.com/prometheus/jmx_exporter ).此后,我通过升级到最新的 jmx_exporter (0.13.0) 并使用示例连接器导出器配置文件 ( https://github.com/prometheus/jmx_exporter ) 找到了解决方法。 I couldn't find a change log to tell what changed, but they "fixed" something.我找不到更改日志来说明发生了什么变化,但他们“修复”了一些东西。

Seems the problem is that the attribute type of connector-metric is double, but value is string.似乎问题在于connector-metric的属性类型是double,但值是string。

Here example how I get status metric:这里示例我如何获取状态指标:

# kafka.connect:type=connector-metrics,connector="{connector}"
  - pattern: 'kafka.connect<type=connector-metrics, connector=(.+)><>status: ([a-z-]+)'
    name: kafka_connectors_status
    value: 1
    labels:
      connector: $1
      status: $2
    help: "Kafka Connect JMX metric connectors status"
    type: GAUGE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM