You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/09/27 17:03:24 UTC

[GitHub] [beam] roger-mike commented on a change in pull request #15294: [BEAM-11986] Spanner write metric

roger-mike commented on a change in pull request #15294:
URL: https://github.com/apache/beam/pull/15294#discussion_r716882573



##########
File path: sdks/python/apache_beam/io/gcp/experimental/spannerio.py
##########
@@ -320,6 +330,42 @@ def __init__(self, spanner_configuration):
     self._spanner_configuration = spanner_configuration
     self._snapshot = None
     self._session = None
+    self.base_labels = {
+        monitoring_infos.SERVICE_LABEL: 'Spanner',
+        monitoring_infos.METHOD_LABEL: 'Read',
+        monitoring_infos.SPANNER_PROJECT_ID: self._spanner_configuration.
+        project,
+        monitoring_infos.SPANNER_DATABASE_ID: self._spanner_configuration.
+        database,
+    }
+
+  def _table_metric(self, table_id, status):
+    database_id = self._spanner_configuration.database
+    project_id = self._spanner_configuration.project
+    resource = resource_identifiers.SpannerTable(
+        project_id, database_id, table_id)
+    labels = {
+        **self.base_labels,
+        monitoring_infos.RESOURCE_LABEL: resource,
+        monitoring_infos.SPANNER_TABLE_ID: table_id
+    }
+    service_call_metric = ServiceCallMetric(

Review comment:
       Done

##########
File path: sdks/python/apache_beam/io/gcp/experimental/spannerio.py
##########
@@ -523,6 +585,42 @@ class _ReadFromPartitionFn(DoFn):
   """
   def __init__(self, spanner_configuration):
     self._spanner_configuration = spanner_configuration
+    self.base_labels = {
+        monitoring_infos.SERVICE_LABEL: 'Spanner',
+        monitoring_infos.METHOD_LABEL: 'Read',
+        monitoring_infos.SPANNER_PROJECT_ID: self._spanner_configuration.

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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org