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 TestScope #120

Merged
merged 1 commit into from
Dec 18, 2023
Merged

Add TestScope #120

merged 1 commit into from
Dec 18, 2023

Conversation

zmanji
Copy link
Contributor

@zmanji zmanji commented Dec 18, 2023

This commit plucks select changes from #69 and #43 to bring uber-java/tally on par with uber-go/tally.

It adds a TestScope class which allows users of the library to get a Snapshot of all the metrics emitted by the scope. Users can then assert if certain metrics were created on the scope.

In order to implement this a NullStatsReporter was added and a TestScope interface was added that exposes
the snapshot method. The snapshot method was also changed to ensure that a subscope's tags were included
when creating the snapshot. Also the putAll method of the ImmutableMap was made null safe. Also ScopeKey
was made null safe.

TestScopeTest shows how the TestScope can be used.

@CLAassistant
Copy link

CLAassistant commented Dec 18, 2023

CLA assistant check
All committers have signed the CLA.

This commit plucks select changes from #69 and #43
to bring uber-java/tally on par with uber-go/tally.

It adds a `TestScope` class which allows users of the library to get a
`Snapshot` of all the metrics emitted by the scope. Users can then assert if
certain metrics were created.
Copy link
Collaborator

@SokolAndrey SokolAndrey left a comment

Choose a reason for hiding this comment

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

lgtm

@SokolAndrey SokolAndrey merged commit 774a8c1 into uber-java:master Dec 18, 2023
1 check passed
@zmanji zmanji deleted the add-test-scope branch December 18, 2023 23:06
@zmanji zmanji mentioned this pull request Jan 3, 2024
SokolAndrey pushed a commit that referenced this pull request Jan 4, 2024
#120 has a bug where the `Snapshot` only
includes the subscopes and not the metrics on the current scope. This fixes the
`snapshot` method to include metrics on the current scope as well.
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