Skip to content

Commit b1469e9

Browse files
Updating tally core dependency. (#769)
* Updating tally core dependency.
1 parent 3c200c1 commit b1469e9

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ dependencies {
6161
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
6262
compile group: 'org.apache.thrift', name: 'libthrift', version: '0.9.3'
6363
compile group: 'com.google.code.gson', name: 'gson', version: '2.10'
64-
compile group: 'com.uber.m3', name: 'tally-core', version: '0.4.0'
64+
compile group: 'com.uber.m3', name: 'tally-core', version: '0.11.1'
6565
compile group: 'com.google.guava', name: 'guava', version: '31.1-jre'
6666
compile group: 'com.cronutils', name: 'cron-utils', version: '9.2.0'
6767
compile group: 'io.micrometer', name: 'micrometer-core', version: '1.10.2'

src/main/java/com/uber/cadence/internal/metrics/NoopScope.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package com.uber.cadence.internal.metrics;
1919

20-
import com.uber.m3.tally.Buckets;
2120
import com.uber.m3.tally.Capabilities;
2221
import com.uber.m3.tally.CapableOf;
2322
import com.uber.m3.tally.Counter;
@@ -52,7 +51,8 @@ public Timer timer(String name) {
5251
}
5352

5453
@Override
55-
public Histogram histogram(String name, Buckets buckets) {
54+
@SuppressWarnings("deprecation")
55+
public Histogram histogram(String name, com.uber.m3.tally.Buckets buckets) {
5656
return noopHistogram;
5757
}
5858

src/main/java/com/uber/cadence/internal/metrics/ReplayAwareScope.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package com.uber.cadence.internal.metrics;
1919

2020
import com.uber.cadence.internal.replay.ReplayAware;
21-
import com.uber.m3.tally.Buckets;
2221
import com.uber.m3.tally.Capabilities;
2322
import com.uber.m3.tally.Counter;
2423
import com.uber.m3.tally.Gauge;
@@ -173,7 +172,8 @@ public Timer timer(String name) {
173172
}
174173

175174
@Override
176-
public Histogram histogram(String name, Buckets buckets) {
175+
@SuppressWarnings("deprecation")
176+
public Histogram histogram(String name, com.uber.m3.tally.Buckets buckets) {
177177
return new ReplayAwareHistogram(scope.histogram(name, buckets));
178178
}
179179

src/main/java/com/uber/cadence/reporter/CadenceClientStatsReporter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.common.collect.ImmutableList;
2323
import com.google.common.util.concurrent.AtomicDouble;
2424
import com.uber.cadence.internal.metrics.MetricsTag;
25-
import com.uber.m3.tally.Buckets;
2625
import com.uber.m3.tally.Capabilities;
2726
import com.uber.m3.tally.CapableOf;
2827
import com.uber.m3.tally.StatsReporter;
@@ -77,21 +76,23 @@ public void reportTimer(String name, Map<String, String> tags, Duration interval
7776
}
7877

7978
@Override
79+
@SuppressWarnings("deprecation")
8080
public void reportHistogramValueSamples(
8181
String name,
8282
Map<String, String> tags,
83-
Buckets buckets,
83+
com.uber.m3.tally.Buckets buckets,
8484
double bucketLowerBound,
8585
double bucketUpperBound,
8686
long samples) {
8787
// NOOP
8888
}
8989

9090
@Override
91+
@SuppressWarnings("deprecation")
9192
public void reportHistogramDurationSamples(
9293
String name,
9394
Map<String, String> tags,
94-
Buckets buckets,
95+
com.uber.m3.tally.Buckets buckets,
9596
Duration bucketLowerBound,
9697
Duration bucketUpperBound,
9798
long samples) {

src/test/java/com/uber/cadence/metrics/ReplayAwareScopeTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import com.uber.cadence.internal.metrics.ReplayAwareScope;
2727
import com.uber.cadence.internal.replay.ReplayAware;
28-
import com.uber.m3.tally.Buckets;
2928
import com.uber.m3.tally.Counter;
3029
import com.uber.m3.tally.Gauge;
3130
import com.uber.m3.tally.Histogram;
@@ -60,20 +59,21 @@ public void testReplayAwareScopeReplaying() {
6059
Timer timer = mock(Timer.class);
6160
Histogram histogram = mock(Histogram.class);
6261

63-
Buckets buckets = ValueBuckets.linear(0, 10, 10);
6462
when(scope.counter("test-counter")).thenReturn(counter);
6563
when(scope.gauge("test-gauge")).thenReturn(gauge);
6664
when(scope.timer("test-timer")).thenReturn(timer);
67-
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
65+
when(scope.histogram("test-histogram", ValueBuckets.linear(0, 10, 10))).thenReturn(histogram);
6866

6967
TestContext context = new TestContext(true);
7068
Scope replayAwareScope = new ReplayAwareScope(scope, context, System::currentTimeMillis);
7169

7270
replayAwareScope.counter("test-counter").inc(1);
7371
replayAwareScope.gauge("test-gauge").update(100.0);
7472
replayAwareScope.timer("test-timer").record(Duration.ofMillis(100));
75-
replayAwareScope.histogram("test-histogram", buckets).recordValue(10);
76-
replayAwareScope.histogram("test-histogram", buckets).recordDuration(Duration.ofHours(1));
73+
replayAwareScope.histogram("test-histogram", ValueBuckets.linear(0, 10, 10)).recordValue(10);
74+
replayAwareScope
75+
.histogram("test-histogram", ValueBuckets.linear(0, 10, 10))
76+
.recordDuration(Duration.ofHours(1));
7777

7878
verify(counter, never()).inc(1);
7979
verify(gauge, never()).update(100.0);
@@ -90,20 +90,21 @@ public void testReplayAwareScopeNotReplaying() {
9090
Timer timer = mock(Timer.class);
9191
Histogram histogram = mock(Histogram.class);
9292

93-
Buckets buckets = ValueBuckets.linear(0, 10, 10);
9493
when(scope.counter("test-counter")).thenReturn(counter);
9594
when(scope.gauge("test-gauge")).thenReturn(gauge);
9695
when(scope.timer("test-timer")).thenReturn(timer);
97-
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
96+
when(scope.histogram("test-histogram", ValueBuckets.linear(0, 10, 10))).thenReturn(histogram);
9897

9998
TestContext context = new TestContext(false);
10099
Scope replayAwareScope = new ReplayAwareScope(scope, context, System::currentTimeMillis);
101100

102101
replayAwareScope.counter("test-counter").inc(1);
103102
replayAwareScope.gauge("test-gauge").update(100.0);
104103
replayAwareScope.timer("test-timer").record(Duration.ofMillis(100));
105-
replayAwareScope.histogram("test-histogram", buckets).recordValue(10);
106-
replayAwareScope.histogram("test-histogram", buckets).recordDuration(Duration.ofHours(1));
104+
replayAwareScope.histogram("test-histogram", ValueBuckets.linear(0, 10, 10)).recordValue(10);
105+
replayAwareScope
106+
.histogram("test-histogram", ValueBuckets.linear(0, 10, 10))
107+
.recordDuration(Duration.ofHours(1));
107108

108109
verify(counter, times(1)).inc(1);
109110
verify(gauge, times(1)).update(100.0);
@@ -131,9 +132,8 @@ public void testCustomClockForTimer() {
131132
Timer timer = mock(Timer.class);
132133
Histogram histogram = mock(Histogram.class);
133134

134-
Buckets buckets = ValueBuckets.linear(0, 10, 10);
135135
when(scope.timer("test-timer")).thenReturn(timer);
136-
when(scope.histogram("test-histogram", buckets)).thenReturn(histogram);
136+
when(scope.histogram("test-histogram", ValueBuckets.linear(0, 10, 10))).thenReturn(histogram);
137137

138138
TestContext context = new TestContext(false);
139139
TestClock clock = new TestClock();
@@ -143,7 +143,7 @@ public void testCustomClockForTimer() {
143143
clock.setTime(100);
144144
sw.stop();
145145

146-
sw = replayAwareScope.histogram("test-histogram", buckets).start();
146+
sw = replayAwareScope.histogram("test-histogram", ValueBuckets.linear(0, 10, 10)).start();
147147
clock.setTime(150);
148148
sw.stop();
149149

0 commit comments

Comments
 (0)