You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Sanil15 (via GitHub)" <gi...@apache.org> on 2023/05/15 22:50:55 UTC

[GitHub] [beam] Sanil15 commented on a diff in pull request #26649: Basic Opeartor Metric Support For Data Shuffle (GBK and Combine Per Key) Operators for Samza Runner

Sanil15 commented on code in PR #26649:
URL: https://github.com/apache/beam/pull/26649#discussion_r1194433462


##########
runners/samza/src/main/java/org/apache/beam/runners/samza/metrics/SamzaInputGBKMetricOp.java:
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.runners.samza.metrics;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.beam.runners.samza.runtime.KeyedTimerData;
+import org.apache.beam.runners.samza.runtime.Op;
+import org.apache.beam.runners.samza.runtime.OpEmitter;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.util.WindowedValue;
+import org.apache.samza.config.Config;
+import org.apache.samza.context.Context;
+import org.apache.samza.operators.Scheduler;
+import org.joda.time.Instant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * SamzaInputGBKMetricOp is a {@link Op} that emits & maintains default metrics for input
+ * PCollection for GroupByKey. It emits the input throughput and maintains avg input time for input
+ * PCollection per windowId.
+ *
+ * <p>Assumes that {@code SamzaInputGBKMetricOp#processWatermark(Instant, OpEmitter)} is exclusive
+ * of {@code SamzaInputGBKMetricOp#processElement(Instant, OpEmitter)}. Specifically, the
+ * processWatermark method assumes that no calls to processElement will be made during its
+ * execution, and vice versa.
+ *
+ * @param <T> The type of the elements in the input PCollection.
+ */
+public class SamzaInputGBKMetricOp<T> implements Op<T, T, Void> {

Review Comment:
   done



##########
runners/samza/src/main/java/org/apache/beam/runners/samza/metrics/SamzaOutputGBKMetricOp.java:
##########
@@ -0,0 +1,163 @@
+/*
+ * 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.runners.samza.metrics;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.beam.runners.samza.runtime.KeyedTimerData;
+import org.apache.beam.runners.samza.runtime.Op;
+import org.apache.beam.runners.samza.runtime.OpEmitter;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.util.WindowedValue;
+import org.apache.samza.config.Config;
+import org.apache.samza.context.Context;
+import org.apache.samza.operators.Scheduler;
+import org.joda.time.Instant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * SamzaOutputGBKMetricOp is a {@link Op} that emits & maintains default metrics for output
+ * PCollection for GroupByKey. It emits the output throughput and maintains avg output time for
+ * output PCollection per windowId (). It is also responsible for emitting latency metric per
+ * windowId once the watermark passes the end of window timestamp.
+ *
+ * <p>Assumes that {@code SamzaOutputGBKMetricOp#processWatermark(Instant, OpEmitter)} is exclusive
+ * of {@code SamzaOutputGBKMetricOp#processElement(Instant, OpEmitter)}. Specifically, the
+ * processWatermark method assumes that no calls to processElement will be made during its
+ * execution, and vice versa.
+ *
+ * @param <T> The type of the elements in the output PCollection.
+ */
+public class SamzaOutputGBKMetricOp<T> implements Op<T, T, Void> {

Review Comment:
   done



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org