Skip to content

Conversation

@ethercflow
Copy link
Contributor

@ethercflow ethercflow commented Oct 28, 2024

Address comments in #230 (comment)

@ethercflow
Copy link
Contributor Author

@mxinden PTAL, thanks!

@cratelyn
Copy link
Contributor

seconding this addition, i would also suppport this change, and would like have the ability to avoid creating new metrics in a family when looking up the series for a particular label set. i'll cross-reference #244, which also introduces a new accessor to Family<S, M, C>.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thank you for the thorough patch.

What do you think of replacing the code below in Family::get_or_create with a call to Family::get?

        if let Ok(metric) =
            RwLockReadGuard::try_map(self.metrics.read(), |metrics| metrics.get(label_set))
        {
            return metric;
        }

Also, please add a changelog entry.

@ethercflow
Copy link
Contributor Author

@mxinden Addressed, PTAL, thanks!

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thank you!

@mxinden mxinden merged commit 93c63db into prometheus:master Dec 3, 2024
10 checks 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.

3 participants