Skip to content

Commit e9e5395

Browse files
authored
Merge pull request #117 from felixbarny/patch-1
Remove sum from Summary
2 parents fc5b534 + c72bbf8 commit e9e5395

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

simpleclient_dropwizard/src/main/java/io/prometheus/client/dropwizard/DropwizardExports.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,14 @@ List<MetricFamilySamples> fromGauge(String name, Gauge gauge) {
6868
*
6969
*/
7070
List<MetricFamilySamples> fromSnapshotAndCount(String name, Snapshot snapshot, long count, double factor, String helpMessage) {
71-
long sum = 0;
72-
for (long i : snapshot.getValues()) {
73-
sum += i;
74-
}
7571
List<MetricFamilySamples.Sample> samples = Arrays.asList(
7672
new MetricFamilySamples.Sample(name, Arrays.asList("quantile"), Arrays.asList("0.5"), snapshot.getMedian() * factor),
7773
new MetricFamilySamples.Sample(name, Arrays.asList("quantile"), Arrays.asList("0.75"), snapshot.get75thPercentile() * factor),
7874
new MetricFamilySamples.Sample(name, Arrays.asList("quantile"), Arrays.asList("0.95"), snapshot.get95thPercentile() * factor),
7975
new MetricFamilySamples.Sample(name, Arrays.asList("quantile"), Arrays.asList("0.98"), snapshot.get98thPercentile() * factor),
8076
new MetricFamilySamples.Sample(name, Arrays.asList("quantile"), Arrays.asList("0.99"), snapshot.get99thPercentile() * factor),
8177
new MetricFamilySamples.Sample(name, Arrays.asList("quantile"), Arrays.asList("0.999"), snapshot.get999thPercentile() * factor),
82-
new MetricFamilySamples.Sample(name + "_count", new ArrayList<String>(), new ArrayList<String>(), count),
83-
new MetricFamilySamples.Sample(name + "_sum", new ArrayList<String>(), new ArrayList<String>(), sum * factor)
78+
new MetricFamilySamples.Sample(name + "_count", new ArrayList<String>(), new ArrayList<String>(), count)
8479
);
8580
return Arrays.asList(
8681
new MetricFamilySamples(name, Type.SUMMARY, helpMessage, samples)

simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/DropwizardExportsTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public void testHistogram() throws IOException {
111111
i += 1;
112112
}
113113
assertEquals(new Double(100), registry.getSampleValue("hist_count"));
114-
assertEquals(new Double(4950), registry.getSampleValue("hist_sum"));
115114
for (double b : Arrays.asList(0.75, 0.95, 0.98, 0.99)) {
116115
assertEquals(new Double((b - 0.01) * 100), registry.getSampleValue("hist",
117116
new String[]{"quantile"}, new String[]{String.format("%.2f", b)}));
@@ -137,7 +136,6 @@ public void testTimer() throws IOException, InterruptedException {
137136
// We slept for 1Ms so we ensure that all timers are above 1ms:
138137
assertTrue(registry.getSampleValue("timer", new String[]{"quantile"}, new String[]{"0.99"}) > 0.001);
139138
assertEquals(new Double(1.0D), registry.getSampleValue("timer_count"));
140-
assertRegistryContainsMetrics("timer_count", "timer_sum");
141139
}
142140

143141
@Test

0 commit comments

Comments
 (0)