tvalentyn commented on code in PR #24599:
URL: https://github.com/apache/beam/pull/24599#discussion_r1131447454


##########
sdks/python/apache_beam/io/gcp/datastore/v1new/util.py:
##########
@@ -137,3 +137,22 @@ def report_latency(self, now, latency_ms, num_mutations):
       num_mutations: int, number of mutations contained in the RPC.
     """
     self._commit_time_per_entity_ms.add(now, latency_ms / num_mutations)
+
+
+def extract_byte_size(proto_message):
+  """
+    Gets the byte size from a google.protobuf or proto-plus message

Review Comment:
   - you can access ByteSize in ProtoPlus message by msg._pb.ByteSize(). We 
access the ._pb in other places in Beam already.
   - you can modify FakeMutation to support the accessor as above.  
   -  given that we increase 'google-cloud-datastore>=2.0.0,<3',  I don't see a 
reason to support older version of the messages.  FakeMutation is purely test 
code, so keeping branching in the SDK code to accommodate the test code sounds 
like unnecessary complexity. 
   



##########
sdks/python/apache_beam/io/gcp/datastore/v1new/util.py:
##########
@@ -137,3 +137,22 @@ def report_latency(self, now, latency_ms, num_mutations):
       num_mutations: int, number of mutations contained in the RPC.
     """
     self._commit_time_per_entity_ms.add(now, latency_ms / num_mutations)
+
+
+def extract_byte_size(proto_message):
+  """
+    Gets the byte size from a google.protobuf or proto-plus message

Review Comment:
   - you can access ByteSize in ProtoPlus message by `msg._pb.ByteSize()`. We 
access the ._pb in other places in Beam already.
   - you can modify FakeMutation to support the accessor as above.  
   -  given that we increase 'google-cloud-datastore>=2.0.0,<3',  I don't see a 
reason to support older version of the messages.  FakeMutation is purely test 
code, so keeping branching in the SDK code to accommodate the test code sounds 
like unnecessary complexity. 
   



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