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

metric: avoid mutex deadlock and fix HdrHistogram.TotalSum #102085

Merged

Conversation

nvanbenschoten
Copy link
Member

The method was calling ToPrometheusMetric, which expects the mutex to be unlocked. However, it was also locking the mutex. This commit fixes the deadlock.

The commit also fixes the implementation, which was broken. ToPrometheusMetric does not populate prometheusgo.Metric.Summary, so the use of GetSummary was broken.

The two bugs indicate a lack of testing coverage for this newly introduced functionality (in a28aa6c). We should add some.

Epic: None
Release note: None

The method was calling ToPrometheusMetric, which expects the mutex to be
unlocked. However, it was also locking the mutex. This commit fixes the deadlock.

The commit also fixes the implementation, which was broken. `ToPrometheusMetric`
does not populate `prometheusgo.Metric.Summary`, so the use of `GetSummary` was
broken.

The two bugs indicate a lack of testing coverage for this newly introduced
functionality (in a28aa6c). We should add some.

Epic: None
Release note: None
@nvanbenschoten nvanbenschoten requested review from dhartunian and a team April 22, 2023 21:12
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroachdb cockroachdb deleted a comment from blathers-crl bot Apr 22, 2023
@abarganier abarganier self-requested a review April 24, 2023 14:25
Copy link
Collaborator

@dhartunian dhartunian 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 @nvanbenschoten obs infra will follow up with testing here.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @abarganier)

@nvanbenschoten
Copy link
Member Author

Thanks @dhartunian!

bors r+

Copy link
Contributor

@abarganier abarganier left a comment

Choose a reason for hiding this comment

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

:lgtm: - thank you for the fix. We'll be sure to follow up with testing.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)


-- commits line 11 at r1:
Ack. I'm bringing it up with the team if it's time to once again rip out the legacy HdrHistogram, or if we should keep it around for a bit longer. If we do end up keeping it around, we'll expand the test coverage.

Code quote:

  The two bugs indicate a lack of testing coverage for this newly introduced
  functionality (in a28aa6cb). We should add some.

@craig
Copy link
Contributor

craig bot commented Apr 24, 2023

Build succeeded:

@craig craig bot merged commit 315e1a3 into cockroachdb:master Apr 24, 2023
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.

4 participants