aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Switching to untracked StatsProvider.
Date Tue, 13 May 2014 01:36:33 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 1c058f721 -> 00e0c57a5


Switching to untracked StatsProvider.

Bugs closed: AURORA-406

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


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

Branch: refs/heads/master
Commit: 00e0c57a5597755d50cfff550ac61e3f3bd44ee7
Parents: 1c058f7
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Mon May 12 18:36:11 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Mon May 12 18:36:11 2014 -0700

----------------------------------------------------------------------
 .../apache/aurora/scheduler/sla/MetricCalculator.java  |  2 +-
 .../aurora/scheduler/sla/MetricCalculatorTest.java     | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/00e0c57a/src/main/java/org/apache/aurora/scheduler/sla/MetricCalculator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/sla/MetricCalculator.java b/src/main/java/org/apache/aurora/scheduler/sla/MetricCalculator.java
index bc90030..13449cc 100644
--- a/src/main/java/org/apache/aurora/scheduler/sla/MetricCalculator.java
+++ b/src/main/java/org/apache/aurora/scheduler/sla/MetricCalculator.java
@@ -137,7 +137,7 @@ class MetricCalculator implements Runnable {
     this.metricCache = CacheBuilder.newBuilder().build(
         new CacheLoader<String, Counter>() {
           public Counter load(String key) {
-            return new Counter(statsProvider);
+            return new Counter(statsProvider.untracked());
           }
         });
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/00e0c57a/src/test/java/org/apache/aurora/scheduler/sla/MetricCalculatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/sla/MetricCalculatorTest.java b/src/test/java/org/apache/aurora/scheduler/sla/MetricCalculatorTest.java
index c5dcc06..0a6025c 100644
--- a/src/test/java/org/apache/aurora/scheduler/sla/MetricCalculatorTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/sla/MetricCalculatorTest.java
@@ -43,10 +43,12 @@ public class MetricCalculatorTest extends EasyMockTest {
   @Before
   public void setUp() throws Exception {
     StatsProvider statsProvider = createMock(StatsProvider.class);
+    StatsProvider untracked = createMock(StatsProvider.class);
     MetricCalculatorSettings settings = new MetricCalculatorSettings(10000);
     storageUtil = new StorageTestUtil(this);
     calculator = new MetricCalculator(storageUtil.storage, clock, settings, statsProvider);
-    expect(statsProvider.makeGauge(EasyMock.anyString(), EasyMock.<Supplier<Number>>anyObject()))
+    expect(statsProvider.untracked()).andReturn(untracked).anyTimes();
+    expect(untracked.makeGauge(EasyMock.anyString(), EasyMock.<Supplier<Number>>anyObject()))
         .andReturn(EasyMock.<Stat<Number>>anyObject())
         .anyTimes();
   }
@@ -54,10 +56,11 @@ public class MetricCalculatorTest extends EasyMockTest {
   @Test
   public void runTest() {
     clock.advance(Amount.of(10L, Time.SECONDS));
-    storageUtil.expectTaskFetch(Query.unscoped(),
-            SlaTestUtil.makeTask(ImmutableMap.of(clock.nowMillis() - 1000, PENDING), 0),
-            SlaTestUtil.makeTask(ImmutableMap.of(clock.nowMillis() - 2000, PENDING), 1),
-            SlaTestUtil.makeTask(ImmutableMap.of(clock.nowMillis() - 3000, PENDING), 2));
+    storageUtil.expectTaskFetch(
+        Query.unscoped(),
+        SlaTestUtil.makeTask(ImmutableMap.of(clock.nowMillis() - 1000, PENDING), 0),
+        SlaTestUtil.makeTask(ImmutableMap.of(clock.nowMillis() - 2000, PENDING), 1),
+        SlaTestUtil.makeTask(ImmutableMap.of(clock.nowMillis() - 3000, PENDING), 2));
     storageUtil.expectOperations();
 
     control.replay();


Mime
View raw message