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 for slashes in metric names
Date Mon, 31 Aug 2015 23:24:45 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 89da936f3 -> c8e65d33e


Allow for slashes in metric names

Bugs closed: AURORA-1282

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


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

Branch: refs/heads/master
Commit: c8e65d33e9d3b3b04254bc39fb56faface626c02
Parents: 89da936
Author: Joe Smith <yasumoto7@gmail.com>
Authored: Mon Aug 31 16:24:28 2015 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Mon Aug 31 16:24:28 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/aurora/blob/c8e65d33/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 f2bd05d..d4b6a31 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
@@ -45,7 +45,7 @@ import org.apache.aurora.common.base.MorePreconditions;
 public class Stats {
 
   private static final Logger LOG = Logger.getLogger(Stats.class.getName());
-  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/c8e65d33/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 91bbc09..5368ba5 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,6 +44,13 @@ public class StatsTest {
   }
 
   @Test
+  public void testSlashesSupported() {
+    AtomicLong slash = Stats.exportLong("d/f");
+    slash.incrementAndGet();
+    assertCounter("d/f", 1);
+  }
+
+  @Test
   public void testNotSame() {
     AtomicLong firstExport = Stats.exportLong("somevar");
     firstExport.incrementAndGet();
@@ -74,16 +81,13 @@ public class StatsTest {
     AtomicLong colon = Stats.exportLong("a:b");
     AtomicLong plus = Stats.exportLong("b+c");
     AtomicLong hyphen = Stats.exportLong("c-d");
-    AtomicLong slash = Stats.exportLong("d/f");
 
     colon.incrementAndGet();
     plus.incrementAndGet();
     hyphen.incrementAndGet();
-    slash.incrementAndGet();
     assertCounter("a_b", 1);
     assertCounter("b_c", 1);
     assertCounter("c_d", 1);
-    assertCounter("d_f", 1);
   }
 
   private void assertCounter(String name, long value) {


Mime
View raw message