Skip to content

Commit 95cfc9e

Browse files
authored
Remove NonNegativeBuckets (#781)
NonNegativeBuckets were used for our generated metrics. However, it is in the public metrics package, and users can rely on it to define their histograms. However, NonNegativeBuckets has a huge number of buckets which lead to large data for the metrics. The users have complained that our buckets are too fine-grained and the cost to export the metrics is quite high. This PR removes the NonNegativeBuckets and forces the user to define their own buckets for their histograms.
1 parent e003116 commit 95cfc9e

File tree

3 files changed

+1
-51
lines changed

3 files changed

+1
-51
lines changed

examples/reverser/reverser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
var stringLength = metrics.NewHistogram(
2727
"reverse_string_length",
2828
"The length of strings passed to the Reverse method",
29-
metrics.NonNegativeBuckets,
29+
[]float64{1, 10, 100, 1000, 10000, 100000, 1000000},
3030
)
3131

3232
// Reverser component.

metrics/buckets.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

metrics/doc.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@
5050
// )
5151
// )
5252
//
53-
// [NonNegativeBuckets] returns a default set of non-negative buckets. It is
54-
// useful when declaring histograms that measure things like memory or latency.
55-
//
56-
// var exampleLatency = metrics.NewHistogram(
57-
// "example_latency",
58-
// "The latency of something, in microseconds",
59-
// metrics.NonNegativeBuckets,
60-
// )
61-
//
6253
// # Updating Metrics
6354
//
6455
// Every metric type has a set of methods you can use to update the metric.

0 commit comments

Comments
 (0)