You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2023/07/27 20:31:50 UTC

[beam] branch users/damccorm/metricError created (now 1b3d3f36076)

This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a change to branch users/damccorm/metricError
in repository https://gitbox.apache.org/repos/asf/beam.git


      at 1b3d3f36076 Return a useful error when we fail to create a MonitoringInfo object

This branch includes the following new commits:

     new 1b3d3f36076 Return a useful error when we fail to create a MonitoringInfo object

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[beam] 01/01: Return a useful error when we fail to create a MonitoringInfo object

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch users/damccorm/metricError
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 1b3d3f36076700dbc1ebc0badf69bb5ce16138ba
Author: Danny McCormick <da...@google.com>
AuthorDate: Thu Jul 27 16:31:35 2023 -0400

    Return a useful error when we fail to create a MonitoringInfo object
---
 sdks/python/apache_beam/metrics/monitoring_infos.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sdks/python/apache_beam/metrics/monitoring_infos.py b/sdks/python/apache_beam/metrics/monitoring_infos.py
index ed7f952cf8e..99e9fbaecef 100644
--- a/sdks/python/apache_beam/metrics/monitoring_infos.py
+++ b/sdks/python/apache_beam/metrics/monitoring_infos.py
@@ -299,8 +299,13 @@ def create_monitoring_info(urn, type_urn, payload, labels=None):
     payload: The payload field to use in the monitoring info.
     labels: The label dictionary to use in the MonitoringInfo.
   """
-  return metrics_pb2.MonitoringInfo(
-      urn=urn, type=type_urn, labels=labels or {}, payload=payload)
+  try:
+    return metrics_pb2.MonitoringInfo(
+        urn=urn, type=type_urn, labels=labels or {}, payload=payload)
+  except TypeError as e:
+    raise Exception(
+        f'Failed to create MonitoringInfo for urn {urn} type {type} labels ' +
+        '{labels} and payload {payload}') from e
 
 
 def is_counter(monitoring_info_proto):