GRPC Service: Use native histogram when enabled (#88804)

* use native histogram when enabled

* enable native histograms permanently for grpc service histogram
pull/88809/head
owensmallwood 12 months ago committed by GitHub
parent 5fc580b401
commit 1059441ec6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      pkg/services/grpcserver/service.go

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"time"
"github.com/grafana/dskit/instrument"
"github.com/grafana/dskit/middleware"
@ -51,10 +52,13 @@ func ProvideService(cfg *setting.Cfg, features featuremgmt.FeatureToggles, authe
// nothing unless the feature is actually enabled.
if grpcRequestDuration == nil {
grpcRequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "grafana",
Name: "grpc_request_duration_seconds",
Help: "Time (in seconds) spent serving HTTP requests.",
Buckets: instrument.DefBuckets,
Namespace: "grafana",
Name: "grpc_request_duration_seconds",
Help: "Time (in seconds) spent serving gRPC calls.",
Buckets: instrument.DefBuckets,
NativeHistogramBucketFactor: 1.1, // enable native histograms
NativeHistogramMaxBucketNumber: 160,
NativeHistogramMinResetDuration: time.Hour,
}, []string{"method", "route", "status_code", "ws"})
if err := registerer.Register(grpcRequestDuration); err != nil {

Loading…
Cancel
Save