|
41 | 41 | import org.apache.beam.sdk.metrics.MetricsEnvironment;
|
42 | 42 | import org.apache.beam.sdk.util.HistogramData;
|
43 | 43 | import org.apache.beam.sdk.values.KV;
|
| 44 | +import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap; |
44 | 45 | import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Lists;
|
45 | 46 | import org.hamcrest.collection.IsMapContaining;
|
46 | 47 | import org.junit.Test;
|
@@ -203,7 +204,10 @@ public void testReportSuccessfulRpcMetrics() throws Exception {
|
203 | 204 | MetricName counterNameDisabledDeletes =
|
204 | 205 | MetricName.named("BigQuerySink", "RpcRequestsCount*rpc_method:APPEND_ROWS;rpc_status:OK;");
|
205 | 206 | MetricName histogramName =
|
206 |
| - MetricName.named("BigQuerySink", "RpcLatency*rpc_method:APPEND_ROWS;"); |
| 207 | + MetricName.named( |
| 208 | + "BigQuerySink", |
| 209 | + "RpcLatency*rpc_method:APPEND_ROWS;", |
| 210 | + ImmutableMap.of("PER_WORKER_METRIC", "true")); |
207 | 211 | HistogramData.BucketType bucketType = HistogramData.ExponentialBuckets.of(0, 17);
|
208 | 212 | testContainer.assertPerWorkerCounterValue(counterNameDisabledDeletes, 1L);
|
209 | 213 | testContainer.assertPerWorkerHistogramValues(histogramName, bucketType, 3.0);
|
@@ -243,7 +247,10 @@ public void testReportFailedRPCMetrics_KnownGrpcError() throws Exception {
|
243 | 247 | MetricName.named(
|
244 | 248 | "BigQuerySink", "RpcRequestsCount*rpc_method:APPEND_ROWS;rpc_status:NOT_FOUND;");
|
245 | 249 | MetricName histogramName =
|
246 |
| - MetricName.named("BigQuerySink", "RpcLatency*rpc_method:APPEND_ROWS;"); |
| 250 | + MetricName.named( |
| 251 | + "BigQuerySink", |
| 252 | + "RpcLatency*rpc_method:APPEND_ROWS;", |
| 253 | + ImmutableMap.of("PER_WORKER_METRIC", "true")); |
247 | 254 | HistogramData.BucketType bucketType = HistogramData.ExponentialBuckets.of(0, 17);
|
248 | 255 | testContainer.assertPerWorkerCounterValue(counterNameDisabledDeletes, 1L);
|
249 | 256 | testContainer.assertPerWorkerHistogramValues(histogramName, bucketType, 5.0);
|
@@ -282,7 +289,10 @@ public void testReportFailedRPCMetrics_UnknownGrpcError() throws Exception {
|
282 | 289 | MetricName.named(
|
283 | 290 | "BigQuerySink", "RpcRequestsCount*rpc_method:APPEND_ROWS;rpc_status:UNKNOWN;");
|
284 | 291 | MetricName histogramName =
|
285 |
| - MetricName.named("BigQuerySink", "RpcLatency*rpc_method:APPEND_ROWS;"); |
| 292 | + MetricName.named( |
| 293 | + "BigQuerySink", |
| 294 | + "RpcLatency*rpc_method:APPEND_ROWS;", |
| 295 | + ImmutableMap.of("PER_WORKER_METRIC", "true")); |
286 | 296 | HistogramData.BucketType bucketType = HistogramData.ExponentialBuckets.of(0, 17);
|
287 | 297 | testContainer.assertPerWorkerCounterValue(counterNameDisabledDeletes, 1L);
|
288 | 298 | testContainer.assertPerWorkerHistogramValues(histogramName, bucketType, 15.0);
|
|
0 commit comments