Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example config file for kafka kraft mode metrics #906

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

KumKeeHyun
Copy link
Contributor

@dhoard

After looking issue #881 and pr #793, i created this pr.

The kraft-related metrics are raft-metrics, raft-channel-metrics, and broker-metadata-metrics, and the reason why these metrics could not be collected with the kafka-2_0_0.yml rules is that the name was set to attrName.

jconsole-raft-metrics

I added the following rules based on kafka-2_0_0.yml file for these metrics.

# Kraft current state info metric rule
- pattern: "kafka.server<type=raft-metrics><>current-state: ([a-z]+)"
  name: kafka_server_raft_metrics_current_state_info
  type: GAUGE
  value: 1
  labels:
    "state": "$1"
# Kraft specific rules for raft-metrics, raft-channel-metrics, broker-metadata-metrics
- pattern: kafka.server<type=(.+)><>([a-z-]+)-total
  name: kafka_server_$1_$2_total
  type: COUNTER
- pattern: kafka.server<type=(.+)><>([a-z-]+)
  name: kafka_server_$1_$2
  type: GAUGE

And we also get these:

# HELP kafka_server_raft_metrics_current_state_info The current state of this member; possible values are leader, candidate, voted, follower, unattached, observer kafka.server:name=null,type=raft-metrics,attribute=current-state
# TYPE kafka_server_raft_metrics_current_state_info gauge
kafka_server_raft_metrics_current_state_info{state="follower",} 1.0
# HELP kafka_server_raft_metrics_log_end_epoch The current raft log end epoch. kafka.server:name=null,type=raft-metrics,attribute=log-end-epoch
# TYPE kafka_server_raft_metrics_log_end_epoch gauge
kafka_server_raft_metrics_log_end_epoch 134.0
...
# HELP kafka_server_raft_channel_metrics_request_total The total number of requests sent kafka.server:name=null,type=raft-channel-metrics,attribute=request-total
# TYPE kafka_server_raft_channel_metrics_request_total counter
kafka_server_raft_channel_metrics_request_total 693158.0
# HELP kafka_server_raft_channel_metrics_response_total The total number of responses received kafka.server:name=null,type=raft-channel-metrics,attribute=response-total
# TYPE kafka_server_raft_channel_metrics_response_total counter
kafka_server_raft_channel_metrics_response_total 693148.0
...

@dhoard
Copy link
Collaborator

dhoard commented Jan 23, 2024

@KumKeeHyun Thanks for the PR! I'll merge the code.

@dhoard dhoard merged commit f96796d into prometheus:main Jan 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants