Skip to content

Commit

Permalink
Enable native histograms in server latency metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
bison committed Oct 28, 2024
1 parent c11aac6 commit 8e5ac70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cmd/server/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,13 @@ func createServerMetrics(disableHistogram bool) (grpc.UnaryServerInterceptor, gr
var opts []grpcprom.ServerMetricsOption
if !disableHistogram {
opts = append(opts, grpcprom.WithServerHandlingTimeHistogram(
grpcprom.WithHistogramBuckets([]float64{.001, .003, .006, .010, .018, .024, .032, .042, .056, .075, .100, .178, .316, .562, 1, 5}),
grpcprom.WithHistogramOpts(&prometheus.HistogramOpts{
NativeHistogramBucketFactor: 1.1, // At most 10% increase from bucket to bucket.
NativeHistogramMaxBucketNumber: 100,
Buckets: []float64{
.001, .003, .006, .010, .018, .024, .032, .042, .056, .075, .100, .178, .316, .562, 1, 5,
},
}),
))
}
srvMetrics := grpcprom.NewServerMetrics(opts...)
Expand Down

0 comments on commit 8e5ac70

Please sign in to comment.