Skip to content

[public-api] Cleanup registration of metrics #9896

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

Closed
wants to merge 1 commit into from

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented May 10, 2022

Description

With #9879 merged, there is always a prometheus.Registry available on the server for use, so we can simplify our logic.

Related Issue(s)

Fixes #

How to test

Unit passes

Release Notes

NONE

Documentation

NONE

@easyCZ easyCZ requested a review from a team May 10, 2022 10:26
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label May 10, 2022
@easyCZ easyCZ force-pushed the mp/pub-api-cleaner-registry branch from bf20c37 to 9df373b Compare May 10, 2022 10:27
@laushinka
Copy link
Contributor

Lol was just about to make the adjustments! #blazingfast

@@ -36,7 +34,7 @@ func TestConnectionCreationWasTracked(t *testing.T) {
WorkspaceId: "some-ID",
})

count, err := testutil.GatherAndCount(registry)
count, err := testutil.GatherAndCount(srv.MetricsRegistry())
assert.NoError(t, err)
assert.Equal(t, 1, count)
Copy link
Contributor

Choose a reason for hiding this comment

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

This now fails because it found more. Is it because now we're using the global registry, there are more metrics that went along with it?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's because the srv.MetricsRegistry() has more metrics than just the 1. We can pass an argument to GatherAndCount to filter on only the ones we are testing. Will fix.

@easyCZ easyCZ force-pushed the mp/pub-api-cleaner-registry branch from 9df373b to abf0e1e Compare May 10, 2022 12:35
@roboquat roboquat added size/L and removed size/S labels May 10, 2022
@easyCZ
Copy link
Member Author

easyCZ commented May 10, 2022

To make the tests work, a significant refactor was needed. This feels unnecessary for the sake of testing a metric so will close this PR and cut a new one with just the refactor. We'll remove the test to reduce the need for indirection just for the sake of the test.

@easyCZ easyCZ closed this May 10, 2022
@easyCZ easyCZ deleted the mp/pub-api-cleaner-registry branch December 8, 2022 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/L team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants