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 prometheus label "raft_cluster" to non-QQ raft metrics (backport #12148) (backport #12216) #12217

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Sep 4, 2024

Adds a <<"raft_cluster">> tag for ra_metrics emitted the stream coordinator and Khepri. By default Ra sets the cluster name as the metrics_key (if not set in config, like it is for QQs). The prometheus plugin ignores atoms that aren't protocol names when rendering labels so these cluster name values disappear. We can convert them into a map #{<<"raft_cluster">> => atom_to_binary(ClusterName, utf8)} to render properly.

Before:

$ curl -s "localhost:15692/metrics/detailed?family=ra_metrics" | grep rabbitmq_raft_term_total
# TYPE rabbitmq_raft_term_total counter
# HELP rabbitmq_raft_term_total Current Raft term number
rabbitmq_raft_term_total{vhost="/",queue="qq"} 9
rabbitmq_raft_term_total 10

After:

$ curl -s "localhost:15692/metrics/detailed?family=ra_metrics" | grep rabbitmq_raft_term_total
# TYPE rabbitmq_raft_term_total counter
# HELP rabbitmq_raft_term_total Current Raft term number
rabbitmq_raft_term_total{vhost="/",queue="qq"} 9
rabbitmq_raft_term_total{raft_cluster="rabbitmq_metadata"} 10

Connects #9665
Connects #12142


This is an automatic backport of pull request #12148 done by Mergify.
This is an automatic backport of pull request #12216 done by Mergify.

@mergify mergify bot added the conflicts label Sep 4, 2024

This comment was marked as resolved.

By default Ra will use the cluster name as the metrics key. Currently
atom values are ignored by the prometheus plugin's tag rendering
functions, so if you have a QQ and Khepri running and request the
`/metrics/per-object` or `/metrics/detailed` endpoints you'll see values
that don't have labels set for the `ra_metrics` metrics:

    # TYPE rabbitmq_raft_term_total counter
    # HELP rabbitmq_raft_term_total Current Raft term number
    rabbitmq_raft_term_total{vhost="/",queue="qq"} 9
    rabbitmq_raft_term_total 10

With this change we map the name of the Ra cluster to a "raft_cluster"
tag, so instead an example metric might be:

    # TYPE rabbitmq_raft_term_total counter
    # HELP rabbitmq_raft_term_total Current Raft term number
    rabbitmq_raft_term_total{vhost="/",queue="qq"} 9
    rabbitmq_raft_term_total{raft_cluster="rabbitmq_metadata"} 10

This affects metrics for Khepri and the stream coordinator.

(cherry picked from commit 512f883)
(cherry picked from commit 983ac8c)
@the-mikedavis the-mikedavis merged commit d150bb8 into v3.13.x Sep 5, 2024
186 checks passed
@the-mikedavis the-mikedavis deleted the mergify/bp/v3.13.x/pr-12216 branch September 5, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant