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 2020/06/24 04:44:44 UTC

[GitHub] [beam] emkornfield commented on a change in pull request #12070: Add some metrics for BigQueryStorageStreamReader

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



##########
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:
       I think you might need to resetart the stopwatch here: https://guava.dev/releases/19.0/api/docs/com/google/common/base/Stopwatch.html#reset()




----------------------------------------------------------------
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:
users@infra.apache.org