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

[BEAM-9703] Fix user distribution metric test by not validating namespace. #11455

Merged
merged 3 commits into from
Apr 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sdks/python/apache_beam/metrics/metric_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ def process(self, element):
# Verify user distribution counter.
metric_results = res.metrics().query()
matcher = MetricResultMatcher(
namespace='apache_beam.metrics.metric_test.SomeDoFn',
step='ApplyPardo',
namespace=hc.contains_string('SomeDoFn'),
name='element_dist',
committed=DistributionMatcher(
sum_value=10, count_value=4, min_value=1, max_value=4))
sum_value=hc.greater_than_or_equal_to(0),
count_value=hc.greater_than_or_equal_to(0),
min_value=hc.greater_than_or_equal_to(0),
Copy link
Member

Choose a reason for hiding this comment

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

Why is min different then the others?

I would expect that the same reason this needs to be >= 0 would be the same reason as the others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough.

My justification was that as long as there is one single update picked up, then other values should be something non-zero. (e.g. count would be at least one).

Maybe I still underestimated how much uncertainties there is.

Updated. Now they are all >=0.

max_value=hc.greater_than_or_equal_to(0)))
hc.assert_that(
metric_results['distributions'], hc.contains_inanyorder(matcher))

Expand Down