Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Avoid recreating the metrics for each cluster to support global labels #82

Merged
merged 4 commits into from
Sep 30, 2019

Conversation

anbarasantr
Copy link
Contributor

This fixes the issue reproduced in 78.
Java prometheus client library does not let us register metrics more than once with different sets of labels. The idea is not to register prometheus metrics for each cluster and to create once with all the labels defined in all the cluster.

@anbarasantr anbarasantr changed the title Avoid recreating the metrics for each cluster Avoid recreating the metrics for each cluster to support global labels Sep 24, 2019
@seglo seglo self-requested a review September 25, 2019 14:25
Copy link
Owner

@seglo seglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround on the PR. I left a few comments.

"environment" -> "prod",
"org" -> "organization2",
"location" -> "canada"
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible for clusters with no labels defined to report metrics. When you use the Strimzi cluster watcher, clusters are added at runtime and will have an empty set of labels. Can you add/update a test to include a cluster with labels defined, and one with none defined, and assert that it works. I assume the result would be blank label values for the clusters that have none defined.

Copy link
Contributor Author

@anbarasantr anbarasantr Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seglo Nice catch :) I added those test cases and made some minor changes in the implementation to accommodate this requirement.

@seglo seglo self-requested a review September 26, 2019 12:52
Copy link
Owner

@seglo seglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Thanks for your patience. Just some minor docs updates.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@seglo seglo self-requested a review September 30, 2019 13:51
Copy link
Owner

@seglo seglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your patience during the review!

@seglo seglo merged commit 225fc62 into seglo:master Sep 30, 2019
@seglo seglo modified the milestones: 0.4.0, 0.5.5 Nov 11, 2019
anbarasantr added a commit to anbarasantr/kafka-lag-exporter that referenced this pull request Nov 24, 2019
seglo#82)

* Avoid recreating the metrics for each cluster

* Handle global labels for `Strimzi` cluster watcher logic

* Refactored as per the comments

* Updated docs as per suggestion
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants