Skip to content

Commit

Permalink
feat(middleware/metrics): make DefaultSecondsHistogram simply
Browse files Browse the repository at this point in the history
support middleware histograms, only need to call DefaultSecondsHistogram without registering DefaultSecondsHistogramView
  • Loading branch information
Ccheers committed Jul 31, 2024
1 parent d6fca5e commit 5f40b2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion middleware/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ func DefaultRequestsCounter(meter metric.Meter, histogramName string) (metric.In
// return metric.Float64Histogram for WithSeconds
// suggest histogramName = <client/server>_requests_seconds_bucket
func DefaultSecondsHistogram(meter metric.Meter, histogramName string) (metric.Float64Histogram, error) {
return meter.Float64Histogram(histogramName, metric.WithUnit("s"))
return meter.Float64Histogram(
histogramName,
metric.WithUnit("s"),
metric.WithExplicitBucketBoundaries(0.005, 0.01, 0.025, 0.05, 0.1, 0.250, 0.5, 1),
)
}

// DefaultSecondsHistogramView
Expand Down

0 comments on commit 5f40b2e

Please sign in to comment.