m-trieu commented on code in PR #30118:
URL: https://github.com/apache/beam/pull/30118#discussion_r1473404584
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/MetricsToPerStepNamespaceMetricsConverter.java:
##########
@@ -52,16 +52,16 @@ private static Optional<MetricValue>
convertCounterToMetricValue(
return Optional.empty();
}
- BigQuerySinkMetrics.ParsedMetricName labeledName =
+ Optional<BigQuerySinkMetrics.ParsedMetricName> labeledName =
Review Comment:
nit: you can do
```
return BigQuerySinkMetrics.parseMetricName(metricName.getName())
// filter for basenames !empty
.filter(labeledName -> !labeledName.isEmpty())
// Only called if above predicate is true
.map(labeledName -> new MetricValue()
.setMetric(labeledName.getBaseName())
.setMetricLabels(labeledName.getMetricLabels())
.setValueInt64(value)));
```
if `BigQuerySinkMetrics.parseMetricName(metricName.getName())` returns null
or the filter predicate fails will default to Optional.empty().
this is more of a style thing
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQuerySinkMetrics.java:
##########
@@ -40,10 +41,10 @@
*
* <p>In general metrics be in the namespace 'BigQuerySink' and have their
name formatted as:
*
- *
<p>'{baseName}-{metricLabelKey1}:{metricLabelVal1};...{metricLabelKeyN}:{metricLabelValN};'
+ *
<p>'{baseName}*{metricLabelKey1}:{metricLabelVal1};...{metricLabelKeyN}:{metricLabelValN};'
*/
public class BigQuerySinkMetrics {
- private static Boolean supportMetricsDeletion = false;
+ private static boolean supportMetricsDeletion = false;
Review Comment:
if this is a constant should be styled as
`private static final boolean SUPPORT_METRICS_DELETION = false;`
--
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]