aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject aurora git commit: Allow dots and hyphens in metric names.
Date Mon, 01 Feb 2016 22:16:06 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 513f4b81b -> 021b2dd65


Allow dots and hyphens in metric names.

This will make sure we won't warn about invalid stat names for valid job identifiers.

Bugs closed: AURORA-1282

Reviewed at https://reviews.apache.org/r/42879/


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

Branch: refs/heads/master
Commit: 021b2dd65c1a193cf2a6a71c7616ec032a8d709a
Parents: 513f4b8
Author: Stephan Erb <stephan@dev.static-void.de>
Authored: Mon Feb 1 14:16:07 2016 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Mon Feb 1 14:16:07 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/aurora/common/stats/Stats.java     |  2 +-
 .../java/org/apache/aurora/common/stats/StatsTest.java | 13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/021b2dd6/commons/src/main/java/org/apache/aurora/common/stats/Stats.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Stats.java b/commons/src/main/java/org/apache/aurora/common/stats/Stats.java
index 613bdb9..bb0af69 100644
--- a/commons/src/main/java/org/apache/aurora/common/stats/Stats.java
+++ b/commons/src/main/java/org/apache/aurora/common/stats/Stats.java
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
 public class Stats {
 
   private static final Logger LOG = LoggerFactory.getLogger(Stats.class);
-  private static final Pattern NOT_NAME_CHAR = Pattern.compile("[^A-Za-z0-9_/]");
+  private static final Pattern NOT_NAME_CHAR = Pattern.compile("[^A-Za-z0-9_/.-]");
 
   private static final ConcurrentMap<String, Stat<?>> VAR_MAP = new MapMaker().makeMap();
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/021b2dd6/commons/src/test/java/org/apache/aurora/common/stats/StatsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/StatsTest.java b/commons/src/test/java/org/apache/aurora/common/stats/StatsTest.java
index 5368ba5..2f3a038 100644
--- a/commons/src/test/java/org/apache/aurora/common/stats/StatsTest.java
+++ b/commons/src/test/java/org/apache/aurora/common/stats/StatsTest.java
@@ -44,10 +44,18 @@ public class StatsTest {
   }
 
   @Test
-  public void testSlashesSupported() {
+  public void testSupportedSpecialChars() {
+    AtomicLong hyphen = Stats.exportLong("c-d");
     AtomicLong slash = Stats.exportLong("d/f");
+    AtomicLong dot = Stats.exportLong("f.g");
+
+    hyphen.incrementAndGet();
     slash.incrementAndGet();
+    dot.incrementAndGet();
+
+    assertCounter("c-d", 1);
     assertCounter("d/f", 1);
+    assertCounter("f.g", 1);
   }
 
   @Test
@@ -80,14 +88,11 @@ public class StatsTest {
   public void testNormalizesIllegalChars() {
     AtomicLong colon = Stats.exportLong("a:b");
     AtomicLong plus = Stats.exportLong("b+c");
-    AtomicLong hyphen = Stats.exportLong("c-d");
 
     colon.incrementAndGet();
     plus.incrementAndGet();
-    hyphen.incrementAndGet();
     assertCounter("a_b", 1);
     assertCounter("b_c", 1);
-    assertCounter("c_d", 1);
   }
 
   private void assertCounter(String name, long value) {


Mime
View raw message