You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2017/01/23 21:18:25 UTC

[3/4] flink git commit: [FLINK-5464] [metrics] Ignore metrics that are null

[FLINK-5464] [metrics] Ignore metrics that are null


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/77047244
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/77047244
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/77047244

Branch: refs/heads/master
Commit: 77047244a1ca2456c2b9fdf7083dd3a7c3aba029
Parents: 02d7e4a
Author: zentol <ch...@apache.org>
Authored: Thu Jan 12 12:41:56 2017 +0100
Committer: zentol <ch...@apache.org>
Committed: Mon Jan 23 22:18:20 2017 +0100

----------------------------------------------------------------------
 .../apache/flink/runtime/metrics/groups/AbstractMetricGroup.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/77047244/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java b/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
index 6ff9776..a19970d 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
@@ -345,6 +345,10 @@ public abstract class AbstractMetricGroup<A extends AbstractMetricGroup<?>> impl
 	 * @param metric the metric to register
 	 */
 	protected void addMetric(String name, Metric metric) {
+		if (metric == null) {
+			LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name);
+			return;
+		}
 		// add the metric only if the group is still open
 		synchronized (this) {
 			if (!closed) {