You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/12/28 12:50:21 UTC

[GitHub] [flink] pnowojski opened a new pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

pnowojski opened a new pull request #14507:
URL: https://github.com/apache/flink/pull/14507


   This PR adds three new metrics:
   
   - `isCausingBackPressure`
   - `isCausingBackPressureRatio`
   - `isBackPressuredRatio`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (**yes** / no)
     - If yes, how is the feature documented? (not applicable / **docs** / JavaDocs / not documented)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751702500


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 4d981ec79b87cfa022db1fe894787ea9983a0aae (Mon Dec 28 12:52:02 UTC 2020)
   
    ✅no warnings
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400",
       "triggerID" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 187c8f9242ac63b704d96f6d16b0ba2e05e7322b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400",
       "triggerID" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9980b32b19a0c064461d21a08b31628860f6c20f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11502",
       "triggerID" : "9980b32b19a0c064461d21a08b31628860f6c20f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 187c8f9242ac63b704d96f6d16b0ba2e05e7322b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400) 
   * 9980b32b19a0c064461d21a08b31628860f6c20f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11502) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] pnowojski commented on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
pnowojski commented on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-752912932


   Due to problems with accuracy (caused by sampling intervals) I've abandoned this approach.
   
   This PR was superseded by https://github.com/apache/flink/pull/14526


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4d981ec79b87cfa022db1fe894787ea9983a0aae UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] rkhachatryan commented on a change in pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #14507:
URL: https://github.com/apache/flink/pull/14507#discussion_r550185523



##########
File path: flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/EMAGaugeSampler.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.flink.metrics;
+
+import javax.annotation.Nullable;
+
+/**
+ * A {@link EMAGaugeSampler} provides an exponential moving average view over a {@link Gauge}.
+ *
+ * <p>As other {@link View}s, advantage of this class is that it is updated in regular intervals by
+ * a background thread.
+ */
+public class EMAGaugeSampler<T extends Number> implements Gauge<Double>, View {
+
+	/** The underlying sampled metric. */
+	private final Gauge<T> source;
+	/** Alpha parameter of the exponential moving average. */
+	private final double alpha;
+	/** The index in the array for the current time. */
+	@Nullable
+	private double currentAverage;
+
+	public EMAGaugeSampler(Gauge<T> source, double alpha) {
+		this.source = source;
+		this.alpha = alpha;
+	}
+
+	@Override
+	public void update() {
+		currentAverage = currentAverage * alpha + source.getValue().doubleValue() * (1.0 - alpha);

Review comment:
       1. How about using only `source.getValue().doubleValue()` for the first update?
   Otherwise, the value can be too small in the beginning.
   
   2. Calling only `source.getValue` inside **this** gauge seems error-prone: it assumes `source.update()` is already called. So I'd  replace the nested gauge with a function.

##########
File path: flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/EMAGaugeSampler.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.flink.metrics;
+
+import javax.annotation.Nullable;
+
+/**
+ * A {@link EMAGaugeSampler} provides an exponential moving average view over a {@link Gauge}.
+ *
+ * <p>As other {@link View}s, advantage of this class is that it is updated in regular intervals by
+ * a background thread.
+ */
+public class EMAGaugeSampler<T extends Number> implements Gauge<Double>, View {

Review comment:
       nit: `EmaGaugeSampler` (camel case is easier to read)

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
##########
@@ -989,6 +990,62 @@ public void testNoBackPressureIfTaskNotStarted() throws Exception {
         assertFalse(task.isBackPressured());
     }
 
+    @Test
+    public void testIsCausingBackPressure() throws Exception {

Review comment:
       nit: `testIsCausingBackPressureMetric`

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
##########
@@ -696,7 +697,24 @@ private void stopTaskExecutorServices() throws Exception {
                             partitionStateChecker,
                             getRpcService().getExecutor());
 
-            taskMetricGroup.gauge(MetricNames.IS_BACKPRESSURED, task::isBackPressured);
+            taskMetricGroup.gauge(MetricNames.IS_BACK_PRESSURED, task::isBackPressured);

Review comment:
       `isBackPressured` is used more often now which might lead to many `volatile` reads (`Future.isDone`).
   However, these reads can be eliminated by exiting the loop as soon as some future is not done (instead of `!allOf(futures).isDone`).
   It would also make the code more readable IMO.
   WDYT?

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
##########
@@ -519,6 +519,11 @@ public boolean isBackPressured() {
         return !CompletableFuture.allOf(outputFutures).isDone();
     }
 
+    public boolean isCausingBackPressure() {
+        return !isBackPressured()
+                && metrics.getIOMetricGroup().getIdleTimeMsPerSecond().getRate() < 1.0;

Review comment:
       Swap `&&` to avoid unnecessary `volatile` reads?

##########
File path: flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/EMAGaugeSampler.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.flink.metrics;
+
+import javax.annotation.Nullable;
+
+/**
+ * A {@link EMAGaugeSampler} provides an exponential moving average view over a {@link Gauge}.
+ *
+ * <p>As other {@link View}s, advantage of this class is that it is updated in regular intervals by
+ * a background thread.
+ */
+public class EMAGaugeSampler<T extends Number> implements Gauge<Double>, View {
+
+	/** The underlying sampled metric. */
+	private final Gauge<T> source;
+	/** Alpha parameter of the exponential moving average. */
+	private final double alpha;
+	/** The index in the array for the current time. */
+	@Nullable
+	private double currentAverage;
+
+	public EMAGaugeSampler(Gauge<T> source, double alpha) {
+		this.source = source;
+		this.alpha = alpha;

Review comment:
       I'd check that `alpha` is in `0..1` and (`source` is not null).

##########
File path: docs/ops/metrics.md
##########
@@ -1245,7 +1245,22 @@ Certain RocksDB native metrics are available but disabled by default, you can fi
     </tr>
     <tr>
       <td>isBackPressured</td>
-      <td>Whether the task is back-pressured.</td>
+      <td>Whether the task is currently back-pressured.</td>
+      <td>Gauge</td>
+    </tr>
+    <tr>
+      <td>isBackPressuredRatio</td>
+      <td>Ratio how often this task is back-pressured. Can have values between 0.0 and 1.0, where value 1.0 means the task is constantly back-pressured. It is created by sampling isBackPressured and averaging the sampled value using the exponential moving average algorithm.</td>

Review comment:
       How about replacing "Ratio how often" with "The percentage of time" ?
   
   I think both aren't very accurate, but 2nd is easier to understand (to me).
   

##########
File path: flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/EMAGaugeSampler.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.flink.metrics;
+
+import javax.annotation.Nullable;
+
+/**
+ * A {@link EMAGaugeSampler} provides an exponential moving average view over a {@link Gauge}.
+ *
+ * <p>As other {@link View}s, advantage of this class is that it is updated in regular intervals by
+ * a background thread.
+ */
+public class EMAGaugeSampler<T extends Number> implements Gauge<Double>, View {
+
+	/** The underlying sampled metric. */
+	private final Gauge<T> source;
+	/** Alpha parameter of the exponential moving average. */
+	private final double alpha;
+	/** The index in the array for the current time. */
+	@Nullable
+	private double currentAverage;

Review comment:
       This can't be nullable (initialize with negative?).

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricNames.java
##########
@@ -57,7 +57,11 @@ private MetricNames() {}
     public static final String MEMORY_COMMITTED = "Committed";
     public static final String MEMORY_MAX = "Max";
 
-    public static final String IS_BACKPRESSURED = "isBackPressured";
+    public static final String IS_BACK_PRESSURED = "isBackPressured";
+    public static final String IS_BACK_PRESSURED_RATIO = "isBackPressuredRatio";

Review comment:
       I see that `IS_BACK_PRESSURED_RATIO` name is derived from `IS_BACK_PRESSURED` but it still sounds strange to me. Looking at just a single metric is even more confusing.
   So I'd name it  `BACK_PRESSURED_RATIO` (also in docs).
   
   ditto: `IS_CAUSING_BACK_PRESSURE_RATIO`




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4d981ec79b87cfa022db1fe894787ea9983a0aae Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388) 
   * 187c8f9242ac63b704d96f6d16b0ba2e05e7322b UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] rkhachatryan commented on a change in pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #14507:
URL: https://github.com/apache/flink/pull/14507#discussion_r550191413



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
##########
@@ -696,7 +697,24 @@ private void stopTaskExecutorServices() throws Exception {
                             partitionStateChecker,
                             getRpcService().getExecutor());
 
-            taskMetricGroup.gauge(MetricNames.IS_BACKPRESSURED, task::isBackPressured);
+            taskMetricGroup.gauge(MetricNames.IS_BACK_PRESSURED, task::isBackPressured);

Review comment:
       `isBackPressured` is now used more often, which might lead to many `volatile` reads (`Future.isDone`).
   However, these reads can be eliminated by exiting the loop once **some** future is not done (instead of `!allOf(futures).isDone`).
   It would also make the code more readable IMO.
   WDYT?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4d981ec79b87cfa022db1fe894787ea9983a0aae Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400",
       "triggerID" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9980b32b19a0c064461d21a08b31628860f6c20f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11502",
       "triggerID" : "9980b32b19a0c064461d21a08b31628860f6c20f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9980b32b19a0c064461d21a08b31628860f6c20f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11502) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] rkhachatryan commented on a change in pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #14507:
URL: https://github.com/apache/flink/pull/14507#discussion_r550185523



##########
File path: flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/EMAGaugeSampler.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.flink.metrics;
+
+import javax.annotation.Nullable;
+
+/**
+ * A {@link EMAGaugeSampler} provides an exponential moving average view over a {@link Gauge}.
+ *
+ * <p>As other {@link View}s, advantage of this class is that it is updated in regular intervals by
+ * a background thread.
+ */
+public class EMAGaugeSampler<T extends Number> implements Gauge<Double>, View {
+
+	/** The underlying sampled metric. */
+	private final Gauge<T> source;
+	/** Alpha parameter of the exponential moving average. */
+	private final double alpha;
+	/** The index in the array for the current time. */
+	@Nullable
+	private double currentAverage;
+
+	public EMAGaugeSampler(Gauge<T> source, double alpha) {
+		this.source = source;
+		this.alpha = alpha;
+	}
+
+	@Override
+	public void update() {
+		currentAverage = currentAverage * alpha + source.getValue().doubleValue() * (1.0 - alpha);

Review comment:
       1. How about using only `source.getValue().doubleValue()` for the first update?
   Otherwise, the value can be too small in the beginning.
   
   2. Calling only `source.getValue` inside **this** gauge seems error-prone: it assumes `source.update()` is already called elsewhere. So I'd  replace the nested gauge with a function (`Supplier`).




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400",
       "triggerID" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9980b32b19a0c064461d21a08b31628860f6c20f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9980b32b19a0c064461d21a08b31628860f6c20f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 187c8f9242ac63b704d96f6d16b0ba2e05e7322b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400) 
   * 9980b32b19a0c064461d21a08b31628860f6c20f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751702500


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 9980b32b19a0c064461d21a08b31628860f6c20f (Fri May 28 06:59:16 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] pnowojski closed pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
pnowojski closed pull request #14507:
URL: https://github.com/apache/flink/pull/14507


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14507: [FLINK-20718][FLINK-20717][metrics] Add isCausingBackPressureRatio and isBackPressuredRatio metrics

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14507:
URL: https://github.com/apache/flink/pull/14507#issuecomment-751709270


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388",
       "triggerID" : "4d981ec79b87cfa022db1fe894787ea9983a0aae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400",
       "triggerID" : "187c8f9242ac63b704d96f6d16b0ba2e05e7322b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4d981ec79b87cfa022db1fe894787ea9983a0aae Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11388) 
   * 187c8f9242ac63b704d96f6d16b0ba2e05e7322b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11400) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org