ajamato commented on a change in pull request #11325: [BEAM-4374, BEAM-6189] 
Delete and remove deprecated Metrics proto
URL: https://github.com/apache/beam/pull/11325#discussion_r404385343
 
 

 ##########
 File path: 
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/fn/control/RegisterAndProcessBundleOperationTest.java
 ##########
 @@ -242,200 +240,6 @@ public void close() {}
     operation.finish();
   }
 
-  @Test
-  public void testTentativeUserMetrics() throws Exception {
-    IdGenerator idGenerator = makeIdGeneratorStartingFrom(777L);
-
-    CountDownLatch processBundleLatch = new CountDownLatch(1);
-
-    final String stepName = "fakeStepNameWithUserMetrics";
-    final String namespace = "sdk/whatever";
-    final String name = "someCounter";
-    final long counterValue = 42;
-
-    final BeamFnApi.Metrics.User.MetricName metricName =
-        BeamFnApi.Metrics.User.MetricName.newBuilder()
-            .setNamespace(namespace)
-            .setName(name)
-            .build();
-
-    InstructionRequestHandler instructionRequestHandler =
-        new InstructionRequestHandler() {
-          @Override
-          public CompletionStage<InstructionResponse> 
handle(InstructionRequest request) {
-            switch (request.getRequestCase()) {
-              case REGISTER:
-                return 
CompletableFuture.completedFuture(responseFor(request).build());
-              case PROCESS_BUNDLE:
-                return MoreFutures.supplyAsync(
-                    () -> {
-                      processBundleLatch.await();
-                      return responseFor(request).build();
-                    });
-              case PROCESS_BUNDLE_PROGRESS:
-                return CompletableFuture.completedFuture(
-                    responseFor(request)
-                        .setProcessBundleProgress(
-                            
BeamFnApi.ProcessBundleProgressResponse.newBuilder()
-                                .setMetrics(
-                                    BeamFnApi.Metrics.newBuilder()
-                                        .putPtransforms(
-                                            stepName,
-                                            
BeamFnApi.Metrics.PTransform.newBuilder()
-                                                .addUser(
-                                                    
BeamFnApi.Metrics.User.newBuilder()
-                                                        
.setMetricName(metricName)
-                                                        .setCounterData(
-                                                            
BeamFnApi.Metrics.User.CounterData
-                                                                .newBuilder()
-                                                                
.setValue(counterValue)))
-                                                .build())))
-                        .build());
-              default:
-                // block forever
-                return new CompletableFuture<>();
-            }
-          }
-
-          @Override
-          public void close() {}
-        };
-
-    RegisterAndProcessBundleOperation operation =
-        new RegisterAndProcessBundleOperation(
-            idGenerator,
-            instructionRequestHandler,
-            mockBeamFnStateDelegator,
-            REGISTER_REQUEST,
-            ImmutableMap.of(),
-            ImmutableMap.of(),
-            ImmutableMap.of(),
-            ImmutableTable.of(),
-            ImmutableMap.of(),
-            mockContext);
-
-    operation.start();
-
-    BeamFnApi.Metrics metrics = 
MoreFutures.get(operation.getProcessBundleProgress()).getMetrics();
-    assertThat(metrics.getPtransformsOrThrow(stepName).getUserCount(), 
equalTo(1));
-
-    BeamFnApi.Metrics.User userMetric = 
metrics.getPtransformsOrThrow(stepName).getUser(0);
-    assertThat(userMetric.getMetricName(), equalTo(metricName));
-    assertThat(userMetric.getCounterData().getValue(), equalTo(counterValue));
-
-    processBundleLatch.countDown();
-    operation.finish();
-  }
-
-  @Test
-  public void testFinalUserMetrics() throws Exception {
-    List<BeamFnApi.InstructionRequest> requests = new ArrayList<>();
-    IdGenerator idGenerator = makeIdGeneratorStartingFrom(777L);
-    ExecutorService executorService = Executors.newCachedThreadPool();
-
-    CountDownLatch processBundleLatch = new CountDownLatch(1);
-
-    final String stepName = "fakeStepNameWithUserMetrics";
-    final String namespace = "sdk/whatever";
-    final String name = "someCounter";
-    final long counterValue = 42;
-    final long finalCounterValue = 77;
-
-    final BeamFnApi.Metrics.User.MetricName metricName =
-        BeamFnApi.Metrics.User.MetricName.newBuilder()
-            .setNamespace(namespace)
-            .setName(name)
-            .build();
-
-    InstructionRequestHandler instructionRequestHandler =
-        new InstructionRequestHandler() {
-          @Override
-          public CompletionStage<InstructionResponse> 
handle(InstructionRequest request) {
-            switch (request.getRequestCase()) {
-              case REGISTER:
-                return 
CompletableFuture.completedFuture(responseFor(request).build());
-              case PROCESS_BUNDLE:
-                return MoreFutures.supplyAsync(
-                    () -> {
-                      processBundleLatch.await();
-                      return responseFor(request)
-                          .setProcessBundle(
-                              BeamFnApi.ProcessBundleResponse.newBuilder()
-                                  .setMetrics(
-                                      BeamFnApi.Metrics.newBuilder()
-                                          .putPtransforms(
-                                              stepName,
-                                              
BeamFnApi.Metrics.PTransform.newBuilder()
-                                                  .addUser(
-                                                      
BeamFnApi.Metrics.User.newBuilder()
-                                                          
.setMetricName(metricName)
-                                                          .setCounterData(
-                                                              
BeamFnApi.Metrics.User.CounterData
-                                                                  .newBuilder()
-                                                                  
.setValue(finalCounterValue)))
-                                                  .build())))
-                          .build();
-                    });
-              case PROCESS_BUNDLE_PROGRESS:
-                return CompletableFuture.completedFuture(
-                    responseFor(request)
-                        .setProcessBundleProgress(
-                            
BeamFnApi.ProcessBundleProgressResponse.newBuilder()
-                                .setMetrics(
-                                    BeamFnApi.Metrics.newBuilder()
-                                        .putPtransforms(
-                                            stepName,
-                                            
BeamFnApi.Metrics.PTransform.newBuilder()
-                                                .addUser(
-                                                    
BeamFnApi.Metrics.User.newBuilder()
-                                                        
.setMetricName(metricName)
-                                                        .setCounterData(
-                                                            
BeamFnApi.Metrics.User.CounterData
-                                                                .newBuilder()
-                                                                
.setValue(counterValue)))
-                                                .build())))
-                        .build());
-              default:
-                // block forever
-                return new CompletableFuture<>();
-            }
-          }
-
-          @Override
-          public void close() {}
-        };
-
-    RegisterAndProcessBundleOperation operation =
-        new RegisterAndProcessBundleOperation(
-            idGenerator,
-            instructionRequestHandler,
-            mockBeamFnStateDelegator,
-            REGISTER_REQUEST,
-            ImmutableMap.of(),
-            ImmutableMap.of(),
-            ImmutableMap.of(),
-            ImmutableTable.of(),
-            ImmutableMap.of(),
-            mockContext);
-
-    operation.start();
-
-    // Force some intermediate metrics to test crosstalk is not introduced
-    BeamFnApi.Metrics metrics = 
MoreFutures.get(operation.getProcessBundleProgress()).getMetrics();
-    BeamFnApi.Metrics.User userMetric = 
metrics.getPtransformsOrThrow(stepName).getUser(0);
-    assertThat(userMetric.getMetricName(), equalTo(metricName));
-    assertThat(userMetric.getCounterData().getValue(), 
not(equalTo(finalCounterValue)));
-
-    processBundleLatch.countDown();
-    operation.finish();
-
-    metrics = MoreFutures.get(operation.getFinalMetrics());
-
-    userMetric = metrics.getPtransformsOrThrow(stepName).getUser(0);
-    assertThat(userMetric.getMetricName(), equalTo(metricName));
-    assertThat(userMetric.getCounterData().getValue(), 
equalTo(finalCounterValue));
-  }
 
 Review comment:
   You way want to add this back, if you truly cannot yet delete the deprecated 
metrics 

----------------------------------------------------------------
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

Reply via email to