mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
GRPC Service: Use native histogram when enabled (#88804)
* use native histogram when enabled * enable native histograms permanently for grpc service histogram
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/grafana/dskit/instrument"
|
"github.com/grafana/dskit/instrument"
|
||||||
"github.com/grafana/dskit/middleware"
|
"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.
|
// nothing unless the feature is actually enabled.
|
||||||
if grpcRequestDuration == nil {
|
if grpcRequestDuration == nil {
|
||||||
grpcRequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
grpcRequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||||
Namespace: "grafana",
|
Namespace: "grafana",
|
||||||
Name: "grpc_request_duration_seconds",
|
Name: "grpc_request_duration_seconds",
|
||||||
Help: "Time (in seconds) spent serving HTTP requests.",
|
Help: "Time (in seconds) spent serving gRPC calls.",
|
||||||
Buckets: instrument.DefBuckets,
|
Buckets: instrument.DefBuckets,
|
||||||
|
NativeHistogramBucketFactor: 1.1, // enable native histograms
|
||||||
|
NativeHistogramMaxBucketNumber: 160,
|
||||||
|
NativeHistogramMinResetDuration: time.Hour,
|
||||||
}, []string{"method", "route", "status_code", "ws"})
|
}, []string{"method", "route", "status_code", "ws"})
|
||||||
|
|
||||||
if err := registerer.Register(grpcRequestDuration); err != nil {
|
if err := registerer.Register(grpcRequestDuration); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user