prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption
Apache License 2.0
3.06k stars 1.2k forks source link

Kafka Metrics showing type as "Untyped" #971

Closed Dharani0618 closed 1 month ago

Dharani0618 commented 5 months ago

Most of the Kafka metrics type is showing as 'untyped' as below.

# HELP kafka_server_ZooKeeperClientMetrics_Min Attribute exposed for management kafka.server:name=ZooKeeperRequestLatencyMs,type=ZooKeeperClientMetrics,attribute=Min
# TYPE kafka_server_ZooKeeperClientMetrics_Min untyped
# HELP java_lang_CodeHeap_non_profiled_nmethods_UsageThreshold java.lang:name=CodeHeap 'non-profiled nmethods',type=MemoryPool,attribute=UsageThreshold
# TYPE java_lang_CodeHeap_non_profiled_nmethods_UsageThreshold untyped
# HELP kafka_server_socket_server_metrics_successful_reauthentication_rate The number of successful re-authentication of connections per second kafka.server:name=null,type=socket-server-metrics,attribute=successful-reauthentication-rate
# TYPE kafka_server_socket_server_metrics_successful_reauthentication_rate untyped

The file metrics.txt consists of all metrics which has type as "untyped"

But the supported Prometheus metric types are Counter | Gauge | Histogram | Summary as per https://prometheus.io/docs/concepts/metric_types/ Is it possible to change type of metrics from "untyped" to the Prometheus supported types?

fstab commented 5 months ago

Sure, that's perfectly possible, but you need to configure which type you want. If you look at the examples in the example_configs/ folder, you will see many examples with type: COUNTER or type: GAUGE.

See for example https://github.com/prometheus/jmx_exporter/blob/main/example_configs/kafka-2_0_0.yml.

Dharani0618 commented 5 months ago

Generally, metrics will take the supported metrics type right? Is there any particular reason why these metrics are showing as "untyped"?

dhoard commented 5 months ago

They are untyped because the code can't infer the metric type simply by looking at the MBean name or attribute name/value.