kmjung commented on a change in pull request #12070:
URL: https://github.com/apache/beam/pull/12070#discussion_r444676334



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.java
##########
@@ -153,6 +156,17 @@ public String toString() {
   @Experimental(Kind.SOURCE_SINK)
   public static class BigQueryStorageStreamReader<T> extends 
BoundedSource.BoundedReader<T> {
 
+    private final Counter streamingResponseCount =
+        Metrics.counter(
+            BigQueryStorageStreamReader.class, 
"bq_storage_read_streaming_response_count");
+    private final Counter streamingResponseTotalLatencyMs =
+        Metrics.counter(

Review comment:
       Done.

##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.java
##########
@@ -247,8 +267,19 @@ private synchronized boolean readNextRecord() throws 
IOException {
             fractionConsumedFromPreviousResponse);
       }
 
-      record = datumReader.read(record, decoder);
-      current = parseFn.apply(new SchemaAndRecord(record, tableSchema));
+      Stopwatch stopwatch = Stopwatch.createStarted();
+      try {
+        record = datumReader.read(record, decoder);
+      } finally {
+        decoderTotalLatencyMs.inc(stopwatch.elapsed(TimeUnit.MILLISECONDS));
+      }
+
+      stopwatch.reset();

Review comment:
       Good catch.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to