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:17:52 UTC

[4/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/30419ff4
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/30419ff4
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/30419ff4

Branch: refs/heads/release-1.2
Commit: 30419ff4a173965a144bf6e44810cf0d17f3962d
Parents: 61c2f2b
Author: zentol <ch...@apache.org>
Authored: Thu Jan 12 12:41:56 2017 +0100
Committer: zentol <ch...@apache.org>
Committed: Mon Jan 23 22:17:36 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/30419ff4/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) {