Naireen commented on code in PR #32027:
URL: https://github.com/apache/beam/pull/32027#discussion_r1714027688
##########
sdks/python/apache_beam/metrics/monitoring_infos.py:
##########
@@ -214,6 +214,11 @@ def int64_user_distribution(namespace, name, metric,
ptransform=None):
ptransform: The ptransform id used as a label.
"""
labels = create_labels(ptransform=ptransform, namespace=namespace, name=name)
+ if metric.count <= 0:
+ raise TypeError(
Review Comment:
For the Dataflow Runner, there are checks when we create the distribution,
so that should be fine. For a user defined counter, what behaviour do you want?
I agree we shouldn't introduce breaking changes. Is it fine to not emit a
counter in that case? If we still want to emit something here, then we'll have
an empty counter, and we'd have to filter it out in the runner to prevent
sending it to the backend (which we don't want to add either based on your
previous comments.)
##########
sdks/python/apache_beam/metrics/monitoring_infos.py:
##########
@@ -214,6 +214,11 @@ def int64_user_distribution(namespace, name, metric,
ptransform=None):
ptransform: The ptransform id used as a label.
"""
labels = create_labels(ptransform=ptransform, namespace=namespace, name=name)
+ if metric.count <= 0:
+ raise TypeError(
+ 'Expected a non zero distribution count for %s metric but received %s'
%
+ (metric, metric.count))
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]