use of com.uber.m3.tally.Gauge in project sdk-java by temporalio.
the class ReplayAwareScopeTest method testReplayAwareScopeReplaying.
@Test
public void testReplayAwareScopeReplaying() {
Scope scope = mock(Scope.class);
Counter counter = mock(Counter.class);
Gauge gauge = mock(Gauge.class);
Timer timer = mock(Timer.class);
Histogram histogram = mock(Histogram.class);
@SuppressWarnings("deprecation") com.uber.m3.tally.Buckets buckets = ValueBuckets.linear(0, 10, 10);
when(scope.counter("test-counter")).thenReturn(counter);
when(scope.gauge("test-gauge")).thenReturn(gauge);
when(scope.timer("test-timer")).thenReturn(timer);
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
TestContext context = new TestContext(true);
Scope replayAwareScope = new ReplayAwareScope(scope, context, System::currentTimeMillis);
replayAwareScope.counter("test-counter").inc(1);
replayAwareScope.gauge("test-gauge").update(100.0);
replayAwareScope.timer("test-timer").record(Duration.ofMillis(100));
replayAwareScope.histogram("test-histogram", buckets).recordValue(10);
replayAwareScope.histogram("test-histogram", buckets).recordDuration(Duration.ofHours(1));
verify(counter, never()).inc(1);
verify(gauge, never()).update(100.0);
verify(timer, never()).record(Duration.ofMillis(100));
verify(histogram, never()).recordValue(10);
verify(histogram, never()).recordDuration(Duration.ofHours(1));
}
use of com.uber.m3.tally.Gauge in project cadence-client by uber-java.
the class ReplayAwareScopeTest method testReplayAwareScopeNotReplaying.
@Test
public void testReplayAwareScopeNotReplaying() {
Scope scope = mock(Scope.class);
Counter counter = mock(Counter.class);
Gauge gauge = mock(Gauge.class);
Timer timer = mock(Timer.class);
Histogram histogram = mock(Histogram.class);
Buckets buckets = ValueBuckets.linear(0, 10, 10);
when(scope.counter("test-counter")).thenReturn(counter);
when(scope.gauge("test-gauge")).thenReturn(gauge);
when(scope.timer("test-timer")).thenReturn(timer);
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
TestContext context = new TestContext(false);
Scope replayAwareScope = new ReplayAwareScope(scope, context, System::currentTimeMillis);
replayAwareScope.counter("test-counter").inc(1);
replayAwareScope.gauge("test-gauge").update(100.0);
replayAwareScope.timer("test-timer").record(Duration.ofMillis(100));
replayAwareScope.histogram("test-histogram", buckets).recordValue(10);
replayAwareScope.histogram("test-histogram", buckets).recordDuration(Duration.ofHours(1));
verify(counter, times(1)).inc(1);
verify(gauge, times(1)).update(100.0);
verify(timer, times(1)).record(Duration.ofMillis(100));
verify(histogram, times(1)).recordValue(10);
verify(histogram, times(1)).recordDuration(Duration.ofHours(1));
}
use of com.uber.m3.tally.Gauge in project cadence-client by uber-java.
the class ReplayAwareScopeTest method testReplayAwareScopeReplaying.
@Test
public void testReplayAwareScopeReplaying() {
Scope scope = mock(Scope.class);
Counter counter = mock(Counter.class);
Gauge gauge = mock(Gauge.class);
Timer timer = mock(Timer.class);
Histogram histogram = mock(Histogram.class);
Buckets buckets = ValueBuckets.linear(0, 10, 10);
when(scope.counter("test-counter")).thenReturn(counter);
when(scope.gauge("test-gauge")).thenReturn(gauge);
when(scope.timer("test-timer")).thenReturn(timer);
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
TestContext context = new TestContext(true);
Scope replayAwareScope = new ReplayAwareScope(scope, context, System::currentTimeMillis);
replayAwareScope.counter("test-counter").inc(1);
replayAwareScope.gauge("test-gauge").update(100.0);
replayAwareScope.timer("test-timer").record(Duration.ofMillis(100));
replayAwareScope.histogram("test-histogram", buckets).recordValue(10);
replayAwareScope.histogram("test-histogram", buckets).recordDuration(Duration.ofHours(1));
verify(counter, never()).inc(1);
verify(gauge, never()).update(100.0);
verify(timer, never()).record(Duration.ofMillis(100));
verify(histogram, never()).recordValue(10);
verify(histogram, never()).recordDuration(Duration.ofHours(1));
}
use of com.uber.m3.tally.Gauge in project sdk-java by temporalio.
the class ReplayAwareScopeTest method testReplayAwareScopeNotReplaying.
@Test
public void testReplayAwareScopeNotReplaying() {
Scope scope = mock(Scope.class);
Counter counter = mock(Counter.class);
Gauge gauge = mock(Gauge.class);
Timer timer = mock(Timer.class);
Histogram histogram = mock(Histogram.class);
@SuppressWarnings("deprecation") com.uber.m3.tally.Buckets buckets = ValueBuckets.linear(0, 10, 10);
when(scope.counter("test-counter")).thenReturn(counter);
when(scope.gauge("test-gauge")).thenReturn(gauge);
when(scope.timer("test-timer")).thenReturn(timer);
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
TestContext context = new TestContext(false);
Scope replayAwareScope = new ReplayAwareScope(scope, context, System::currentTimeMillis);
replayAwareScope.counter("test-counter").inc(1);
replayAwareScope.gauge("test-gauge").update(100.0);
replayAwareScope.timer("test-timer").record(Duration.ofMillis(100));
replayAwareScope.histogram("test-histogram", buckets).recordValue(10);
replayAwareScope.histogram("test-histogram", buckets).recordDuration(Duration.ofHours(1));
verify(counter, times(1)).inc(1);
verify(gauge, times(1)).update(100.0);
verify(timer, times(1)).record(Duration.ofMillis(100));
verify(histogram, times(1)).recordValue(10);
verify(histogram, times(1)).recordDuration(Duration.ofHours(1));
}
Aggregations