[ 
https://issues.apache.org/jira/browse/BEAM-6100?focusedWorklogId=170316&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-170316
 ]

ASF GitHub Bot logged work on BEAM-6100:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Nov/18 17:04
            Start Date: 28/Nov/18 17:04
    Worklog Time Spent: 10m 
      Work Description: swegner commented on a change in pull request #7087: 
[BEAM-6100] Collect metrics properly in Load tests
URL: https://github.com/apache/beam/pull/7087#discussion_r237176261
 
 

 ##########
 File path: 
sdks/java/testing/load-tests/src/main/java/org/apache/beam/sdk/loadtests/metrics/TimeMonitor.java
 ##########
 @@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.loadtests.metrics;
+
+import org.apache.beam.sdk.metrics.Distribution;
+import org.apache.beam.sdk.metrics.Metrics;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.values.KV;
+
+/** Monitor that records processing time distribution in the pipeline. */
 
 Review comment:
   > the code you mentioned is in beam-runners-core-construction-java. That 
means the load_tests package would need to depend on it. Is it ok to have such 
dependency?
   
   
[`Pipeline.replaceAll()`](https://github.com/apache/beam/blob/658630d8f75281f50dc434f2e062e2819ebeff84/sdks/java/core/src/main/java/org/apache/beam/sdk/Pipeline.java#L206)
 is part of `beam-sdks-java-core`, so it would be fine to depend on.
   
   > I didn't check well enough yet but it seems feasible to look for all the 
leaves of the Job DAG, am I right (or maybe I didn't see something coming)? 
That would be needed to find out where should we put TimeMonitors to collect 
end times.
   
   I worked with this code myself, so I can't attest to the pitfalls we might 
find. But the 
[`PTransformMatcher`](https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/runners/PTransformMatcher.java)
 matches on an 
[`AppliedPTransform`](https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/runners/AppliedPTransform.java),
 which has `getInputs()` and `getOutputs()` APIs. Then you would implement a 
[`PTransformOverrideFactory`](https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/runners/PTransformOverrideFactory.java)
 `getReplacementTransform()` and then somehow wrap each source/sink to include 
the monitor.
   
   However, an issue for sources is that they must be at a root of the DAG, so 
we cannot insert the monitor before. Wrapping the source in a composite to get 
the type signature right won't help; runners will expand composites to their 
primitives for execution and the source would still be a root. This would be a 
blocker until we have Splittable DoFns which can receive input.
   
   > If the type of a job graph is different than PCollection<KV<byte[], 
byte[]>> then we might have trouble because I don't think we can infer what 
types TimeMonitor should accept.
   
   That's a good point. To be more general we could possibly try to use the 
type coder and record encoded byte size. But, this is getting complicated..
   
   > Let me know what you think. Either way, I suggest creating a separate 
ticket/PR for this too in order not to block other work.
   
   The more we talk about it, the more it sounds like overkill. I would 
recommend discarding this idea as impractical.

----------------------------------------------------------------
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: 170316)
    Time Spent: 3h 40m  (was: 3.5h)

> Runtime and total bytes metrics are not collected properly
> ----------------------------------------------------------
>
>                 Key: BEAM-6100
>                 URL: https://issues.apache.org/jira/browse/BEAM-6100
>             Project: Beam
>          Issue Type: Sub-task
>          Components: testing
>            Reporter: Lukasz Gajowy
>            Assignee: Lukasz Gajowy
>            Priority: Major
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> Currently, we collect time (distribution) and bytes (counter) metrics from 
> one ParDo (called MetricsMonitor) that is put in pipelines in one, 
> arbitrarily chosen place (usually "in the middle" of pipeline's graph. In 
> some cases, invalid time (or total bytes count) is registered. 
> Taking [this|https://github.com/apache/beam/pull/6987#discussion_r231976671] 
> discussion into account, ideally, we'd like to:
>  - collect runtime by recording time at the root and sink(s) of the pipeline
>  - collect total bytes in a separate ParDo that allows deciding what byte 
> amount do we actually want to collect (now it's coupled to the 
> time-collecting Monitor which is inconvenient).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to