[
https://issues.apache.org/jira/browse/BEAM-6181?focusedWorklogId=172552&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-172552
]
ASF GitHub Bot logged work on BEAM-6181:
----------------------------------------
Author: ASF GitHub Bot
Created on: 06/Dec/18 01:30
Start Date: 06/Dec/18 01:30
Worklog Time Spent: 10m
Work Description: ajamato commented on a change in pull request #7202:
[BEAM-6181] Reporting user counters via MonitoringInfos in Portable Dataflow
Runner.
URL: https://github.com/apache/beam/pull/7202#discussion_r239301128
##########
File path:
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/fn/control/BeamFnMapTaskExecutorTest.java
##########
@@ -423,6 +434,187 @@ public void close() {}
contains(new
CounterHamcrestMatchers.CounterUpdateIntegerValueMatcher(finalCounterValue)));
}
+ @Test(timeout = ReadOperation.DEFAULT_PROGRESS_UPDATE_PERIOD_MS * 10)
+ public void
testExtractCounterUpdatesReturnsValidProgressTrackerCounterUpdatesIfPresent()
+ throws Exception {
+ final String stepName = "fakeStepNameWithUserMetrics";
+ final String namespace = "sdk/whatever";
+ final String name = "someCounter";
+ final int counterValue = 42;
+ final int finalCounterValue = 77;
+ final CountDownLatch progressSentLatch = new CountDownLatch(1);
+ final CountDownLatch processBundleLatch = new CountDownLatch(1);
+
+ final BeamFnApi.Metrics.User.MetricName metricName =
+ BeamFnApi.Metrics.User.MetricName.newBuilder()
+ .setNamespace(namespace)
+ .setName(name)
+ .build();
+
+ final BeamFnApi.Metrics deprecatedMetrics =
+ BeamFnApi.Metrics.newBuilder()
+ .putPtransforms(GRPC_READ_ID, FAKE_ELEMENT_COUNT_METRICS)
+ .putPtransforms(
+ stepName,
+ BeamFnApi.Metrics.PTransform.newBuilder()
+ .addUser(
+ BeamFnApi.Metrics.User.newBuilder()
+ .setMetricName(metricName)
+ .setCounterData(
+ BeamFnApi.Metrics.User.CounterData.newBuilder()
+ .setValue(finalCounterValue)))
+ .build())
+ .build();
+
+ final int expectedCounterValue = 5;
+ final BeamFnApi.MonitoringInfo expectedMonitoringInfo =
+ BeamFnApi.MonitoringInfo.newBuilder()
+ .setUrn("beam:metric:user:ExpectedCounter")
+ .setType("beam:metrics:sum_int_64")
+ .putLabels("PTRANSFORM", "ExpectedPTransform")
+ .setMetric(
+ BeamFnApi.Metric.newBuilder()
+ .setCounterData(
+ BeamFnApi.CounterData.newBuilder()
+ .setInt64Value(expectedCounterValue)
+ .build())
+ .build())
+ .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(deprecatedMetrics)
+ .addMonitoringInfos(expectedMonitoringInfo))
+ .build();
+ });
+ case PROCESS_BUNDLE_PROGRESS:
+ progressSentLatch.countDown();
+ return CompletableFuture.completedFuture(
+ responseFor(request)
+ .setProcessBundleProgress(
+
BeamFnApi.ProcessBundleProgressResponse.newBuilder()
+ .setMetrics(deprecatedMetrics)
+ .addMonitoringInfos(expectedMonitoringInfo))
+ .build());
+ default:
+ throw new RuntimeException("Reached unexpected code path");
+ }
+ }
+
+ @Override
+ public void close() {}
+ };
+
+ Map<String, DataflowStepContext> stepContextMap = new HashMap<>();
+ NameContext nc =
+ new NameContext() {
Review comment:
Do you need to override this and make a new class? Or is it possible to just
instantiate an existing class and passing in these strings?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 172552)
Time Spent: 3.5h (was: 3h 20m)
> Utilize MetricInfo for reporting user metrics in Portable Dataflow Java
> Runner.
> -------------------------------------------------------------------------------
>
> Key: BEAM-6181
> URL: https://issues.apache.org/jira/browse/BEAM-6181
> Project: Beam
> Issue Type: Bug
> Components: java-fn-execution
> Reporter: Mikhail Gryzykhin
> Assignee: Mikhail Gryzykhin
> Priority: Major
> Time Spent: 3.5h
> Remaining Estimate: 0h
>
> New approach to report metrics in FnApi is to utilize MetricInfo structures.
> This approach is implemented in Python SDK and work is ongoing in Java SDK.
> This tasks includes plumbing User metrics reported via MetricInfos through
> Dataflow Java Runner.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)