File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
src/main/java/io/cdap/plugin/gcp/bigquery/action Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 2020
2121 <groupId >io.cdap.plugin</groupId >
2222 <artifactId >google-cloud</artifactId >
23- <version >0.22.4 </version >
23+ <version >0.22.5 </version >
2424 <name >Google Cloud Plugins</name >
2525 <packaging >jar</packaging >
2626 <description >Plugins for Google Big Query</description >
Original file line number Diff line number Diff line change @@ -169,14 +169,24 @@ public void run(ActionContext context) throws Exception {
169169 }
170170 }
171171
172+ context .getMetrics ().gauge (RECORDS_PROCESSED , rows );
173+ try {
174+ recordBytesProcessedMetric (context , queryJob );
175+ } catch (Exception exception ) {
176+ // log the exception but not fail the pipeline
177+ LOG .warn ("Exception while trying to emit bytes processed metric." ,
178+ exception );
179+ }
180+ }
181+
182+ private void recordBytesProcessedMetric (ActionContext context , Job queryJob ) {
172183 long processedBytes =
173184 ((JobStatistics .QueryStatistics ) queryJob .getStatistics ()).getTotalBytesProcessed ();
174185 LOG .info ("Job {} processed {} bytes" , queryJob .getJobId (), processedBytes );
175186 Map <String , String > tags = new ImmutableMap .Builder <String , String >()
176187 .put (Constants .Metrics .Tag .APP_ENTITY_TYPE , Action .PLUGIN_TYPE )
177188 .put (Constants .Metrics .Tag .APP_ENTITY_TYPE_NAME , BigQueryExecute .NAME )
178189 .build ();
179- context .getMetrics ().gauge (RECORDS_PROCESSED , rows );
180190 context .getMetrics ().child (tags ).countLong (BigQuerySinkUtils .BYTES_PROCESSED_METRIC ,
181191 processedBytes );
182192 }
You can’t perform that action at this time.
0 commit comments