ajamato commented on a change in pull request #11184: [BEAM-4374] Update protos
related to MonitoringInfo.
URL: https://github.com/apache/beam/pull/11184#discussion_r398812690
##########
File path:
runners/portability/java/src/main/java/org/apache/beam/runners/portability/PortableMetrics.java
##########
@@ -115,17 +113,15 @@ private static PortableMetrics
convertMonitoringInfosToMetricResults(
MetricKey.create(
labelsMap.get(STEP_NAME_LABEL),
MetricName.named(labelsMap.get(NAMESPACE_LABEL),
labelsMap.get(METRIC_NAME_LABEL)));
- MetricsApi.IntExtremaData extremaData =
- monitoringInfo.getMetric().getExtremaData().getIntExtremaData();
- // Get only last value of the extrema table
- Instant timestamp =
Instant.ofEpochSecond(monitoringInfo.getTimestamp().getSeconds());
- if (extremaData.getIntValuesCount() > 0) {
- GaugeResult result =
- GaugeResult.create(
- extremaData.getIntValues(extremaData.getIntValuesCount() - 1),
timestamp);
+ try {
+ InputStream input = monitoringInfo.getPayload().newInput();
+ long timestamp = VARINT_CODER.decode(input);
Review comment:
ditto, please use a helper here to make this a one liner to extract the value
----------------------------------------------------------------
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]
With regards,
Apache Git Services