flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject flink git commit: [FLINK-4206][metrics] Remove alphanumeric name restriction
Date Thu, 14 Jul 2016 09:11:12 GMT
Repository: flink
Updated Branches:
  refs/heads/master 0db804b93 -> cc60ba42b


[FLINK-4206][metrics] Remove alphanumeric name restriction

This closes #2237


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

Branch: refs/heads/master
Commit: cc60ba42b46df85ececf38d69af2201449e9318c
Parents: 0db804b
Author: zentol <chesnay@apache.org>
Authored: Wed Jul 13 11:03:08 2016 +0200
Committer: Robert Metzger <rmetzger@apache.org>
Committed: Thu Jul 14 11:11:02 2016 +0200

----------------------------------------------------------------------
 .../metrics/groups/AbstractMetricGroup.java     | 20 --------------------
 .../groups/MetricGroupRegistrationTest.java     | 15 ---------------
 .../flink/metrics/groups/MetricGroupTest.java   |  7 -------
 3 files changed, 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/cc60ba42/flink-core/src/main/java/org/apache/flink/metrics/groups/AbstractMetricGroup.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/metrics/groups/AbstractMetricGroup.java
b/flink-core/src/main/java/org/apache/flink/metrics/groups/AbstractMetricGroup.java
index 23487f8..4daead3 100644
--- a/flink-core/src/main/java/org/apache/flink/metrics/groups/AbstractMetricGroup.java
+++ b/flink-core/src/main/java/org/apache/flink/metrics/groups/AbstractMetricGroup.java
@@ -191,9 +191,6 @@ public abstract class AbstractMetricGroup implements MetricGroup {
 	 * @param metric the metric to register
 	 */
 	protected void addMetric(String name, Metric metric) {
-		// early reject names that will later cause issues
-		checkAllowedCharacters(name);
-
 		// add the metric only if the group is still open
 		synchronized (this) {
 			if (!closed) {
@@ -267,21 +264,4 @@ public abstract class AbstractMetricGroup implements MetricGroup {
 			}
 		}
 	}
-
-	// ------------------------------------------------------------------------
-	//  Utilities
-	// ------------------------------------------------------------------------
-
-	/**
-	 * Fast implementation to check if a string has only alphanumeric characters.
-	 * Compared to a regular expression, this is about an order of magnitude faster.
-	 */
-	private static void checkAllowedCharacters(String name) {
-		for (int i = 0; i < name.length(); i++) {
-			final char c = name.charAt(i);
-			if (c < 0x30 || (c >= 0x3a && c <= 0x40) || (c > 0x5a && c
<= 0x60) || c > 0x7a) {
-				throw new IllegalArgumentException("Metric names may only contain [a-zA-Z0-9].");
-			}
-		}
-	}
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/cc60ba42/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupRegistrationTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupRegistrationTest.java
b/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupRegistrationTest.java
index 70827b8..2a737df 100644
--- a/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupRegistrationTest.java
+++ b/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupRegistrationTest.java
@@ -95,21 +95,6 @@ public class MetricGroupRegistrationTest {
 	}
 
 	/**
-	 * Verifies that metric names containing special characters are rejected.
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testInvalidMetricName() {
-		Configuration config = new Configuration();
-
-		MetricRegistry registry = new MetricRegistry(config);
-
-		MetricGroup root = new TaskManagerMetricGroup(registry, "host", "id");
-		root.counter("=)(/!");
-
-		registry.shutdown();
-	}
-
-	/**
 	 * Verifies that when attempting to create a group with the name of an existing one the
existing one will be returned instead.
 	 */
 	@Test

http://git-wip-us.apache.org/repos/asf/flink/blob/cc60ba42/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupTest.java
b/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupTest.java
index 3f8a577..bef01ea 100644
--- a/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupTest.java
+++ b/flink-core/src/test/java/org/apache/flink/metrics/groups/MetricGroupTest.java
@@ -112,13 +112,6 @@ public class MetricGroupTest {
 		assertNotNull(group.counter(name));
 	}
 	
-	@Test(expected = IllegalArgumentException.class)
-	public void exceptionOnIllegalName() {
-		GenericMetricGroup group = new GenericMetricGroup(
-				exceptionOnRegister, new DummyAbstractMetricGroup(exceptionOnRegister), "testgroup");
-		group.counter("ÜberCöunter");
-	}
-	
 	// ------------------------------------------------------------------------
 	
 	private static class ExceptionOnRegisterRegistry extends MetricRegistry {


Mime
View raw message