benWize commented on a change in pull request #15562:
URL: https://github.com/apache/beam/pull/15562#discussion_r715060693



##########
File path: sdks/python/apache_beam/io/gcp/bigtableio.py
##########
@@ -87,14 +113,45 @@ def __setstate__(self, options):
     self.beam_options = options
     self.table = None
     self.batcher = None
+    self.service_call_metric = None
     self.written = Metrics.counter(self.__class__, 'Written Row')
 
+  def write_mutate_metrics(self, rows):
+    for status in rows:
+      if status.code == 0:
+        self.service_call_metric.call(
+            0)  #TODO (BEAM-11985) Handle grpc status codes
+      else:
+        self.service_call_metric.call(status.code)
+
+  def start_service_call_metrics(self, project_id, instance_id, table_id):
+    resource = resource_identifiers.BigtableTable(
+        project_id, instance_id, table_id)
+    labels = {
+        monitoring_infos.SERVICE_LABEL: 'BigTable',
+        # TODO(JIRA-11985): Add Ptransform label.
+        monitoring_infos.METHOD_LABEL: 'google.bigtable.v2.MutateRows',
+        monitoring_infos.RESOURCE_LABEL: resource,
+        monitoring_infos.BIGTABLE_PROJECT_ID_LABEL: self.

Review comment:
       Thanks, I made both changes




-- 
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]


Reply via email to