Skip to content

Commit

Permalink
Remove NonNegativeBuckets (#781)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rgrandl committed Jul 11, 2024
1 parent e003116 commit 95cfc9e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 51 deletions.
2 changes: 1 addition & 1 deletion examples/reverser/reverser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
var stringLength = metrics.NewHistogram(
"reverse_string_length",
"The length of strings passed to the Reverse method",
metrics.NonNegativeBuckets,
[]float64{1, 10, 100, 1000, 10000, 100000, 1000000},
)

// Reverser component.
Expand Down
41 changes: 0 additions & 41 deletions metrics/buckets.go

This file was deleted.

9 changes: 0 additions & 9 deletions metrics/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@
// )
// )
//
// [NonNegativeBuckets] returns a default set of non-negative buckets. It is
// useful when declaring histograms that measure things like memory or latency.
//
// var exampleLatency = metrics.NewHistogram(
// "example_latency",
// "The latency of something, in microseconds",
// metrics.NonNegativeBuckets,
// )
//
// # Updating Metrics
//
// Every metric type has a set of methods you can use to update the metric.
Expand Down

0 comments on commit 95cfc9e

Please sign in to comment.