Skip to content

Commit

Permalink
feat: Add handling time histogram with custom buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jun 28, 2024
1 parent fcbe764 commit 595e8fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/output/xatu/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func NewItemExporter(name string, config *Config, log logrus.FieldLogger) (ItemE
opts := []grpc.DialOption{
grpc.WithChainUnaryInterceptor(grpc_prometheus.UnaryClientInterceptor, retry.UnaryClientInterceptor()),
grpc.WithChainStreamInterceptor(grpc_prometheus.StreamClientInterceptor, retry.StreamClientInterceptor()),
grpc.WithTimeout(config.ExportTimeout),
}

if config.TLS {
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/go-co-op/gocron"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/sdk/trace"
Expand Down Expand Up @@ -269,7 +270,7 @@ func (x *Xatu) startGrpcServer(ctx context.Context) error {

mb100 := 1024 * 1024 * 100

grpc_prometheus.EnableHandlingTimeHistogram()
grpc_prometheus.EnableHandlingTimeHistogram(grpc_prometheus.WithHistogramBuckets(prometheus.ExponentialBucketsRange(0.1, 30, 10)))

opts := []grpc.ServerOption{
grpc.MaxRecvMsgSize(mb100),
Expand Down

0 comments on commit 595e8fe

Please sign in to comment.