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 abstract build method to MetricSnapshot.Builder #969

Merged
merged 1 commit into from
Sep 7, 2024

Conversation

mimaison
Copy link
Contributor

Having an abstract build() method allows writing generic code for the different builders.

For context, I'm currently updating a library from simpleclient to the new 1.X version. The library converts metrics from Apache Kafka where we can have multiple metric objects with the same metric name but different labels.

With simpleclient, we could also have multiple MetricFamilySamples with the same name, but that's not the case anymore with MetricSnapshots where each MetricSnapshot must have a unique name.

So when converting metrics from Kafka, we need to keep un-built MetricSnapshot.Builder and add datapoints when we find metrics with the same names. In this example being able to store various MetricSnapshot.Builder objects in a collection is useful and allows building them all easily.

@mimaison
Copy link
Contributor Author

mimaison commented Jul 3, 2024

@fstab @dhoard @tomwilkie Can you take a look? Thanks

@dhoard dhoard requested a review from fstab July 4, 2024 12:06
@mimaison
Copy link
Contributor Author

Ping @fstab @dhoard @tomwilkie

@dhoard dhoard merged commit 8a24bde into prometheus:main Sep 7, 2024
2 checks passed
@dhoard
Copy link
Collaborator

dhoard commented Sep 7, 2024

@mimaison Thanks for the PR!

@mimaison mimaison deleted the abstract-build branch September 9, 2024 13:28
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