使用jmx exporter for prometheus缺少合流kafka连接度量

zpqajqem  于 2021-06-04  发布在  Kafka
关注(0)|答案(2)|浏览(676)

我无法导出汇合连接服务的“type=connector metrics”度量,但其他度量工作正常。
我正在使用prometheus exporter java代理公开confluent connect的度量,如下所示。

合流连接配置(/usr/bin/connect-distributed)

export kafka\u opts='-javaagent:/opt/prometheus/jmx\u prometheus\u javaagent-0.12.0.jar=8093:/opt/prometheus/kafka connect.yml'

Kafka连接.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

使用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;

汇合连接版本-5.4
有没有解决上述问题的建议?

thtygnil

thtygnil1#

问题似乎是连接器度量的属性类型是double,而值是string。
下面是如何获取状态度量的示例:


# 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
odopli94

odopli942#

我一直在为同一问题绞尽脑汁。此后,我通过升级到最新的jmxèu exporter(0.13.0)并使用示例连接器导出器配置文件找到了修复方法(https://github.com/prometheus/jmx_exporter) . 我找不到更改日志来说明更改了什么,但他们“修复”了一些内容。

相关问题