mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
7008ac01fa
As per https://github.com/etcd-io/etcd/blob/fa57f7fbc787b4/Gopkg.lock List of packages required by subset of etcd used is provided by: go list -f '{{join .Deps "\n"}}' \ github.com/docker/docker/vendor/github.com/coreos/etcd/... \ | grep -F . | grep -v coreos/etcd | sort | uniq Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
// Copyright 2016 Michal Witkowski. All Rights Reserved.
|
|
// See LICENSE for licensing terms.
|
|
|
|
// gRPC Prometheus monitoring interceptors for client-side gRPC.
|
|
|
|
package grpc_prometheus
|
|
|
|
import (
|
|
prom "github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
var (
|
|
// DefaultClientMetrics is the default instance of ClientMetrics. It is
|
|
// intended to be used in conjunction the default Prometheus metrics
|
|
// registry.
|
|
DefaultClientMetrics = NewClientMetrics()
|
|
|
|
// UnaryClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Unary RPCs.
|
|
UnaryClientInterceptor = DefaultClientMetrics.UnaryClientInterceptor()
|
|
|
|
// StreamClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Streaming RPCs.
|
|
StreamClientInterceptor = DefaultClientMetrics.StreamClientInterceptor()
|
|
)
|
|
|
|
func init() {
|
|
prom.MustRegister(DefaultClientMetrics.clientStartedCounter)
|
|
prom.MustRegister(DefaultClientMetrics.clientHandledCounter)
|
|
prom.MustRegister(DefaultClientMetrics.clientStreamMsgReceived)
|
|
prom.MustRegister(DefaultClientMetrics.clientStreamMsgSent)
|
|
}
|
|
|
|
// EnableClientHandlingTimeHistogram turns on recording of handling time of
|
|
// RPCs. Histogram metrics can be very expensive for Prometheus to retain and
|
|
// query. This function acts on the DefaultClientMetrics variable and the
|
|
// default Prometheus metrics registry.
|
|
func EnableClientHandlingTimeHistogram(opts ...HistogramOption) {
|
|
DefaultClientMetrics.EnableClientHandlingTimeHistogram(opts...)
|
|
prom.Register(DefaultClientMetrics.clientHandledHistogram)
|
|
}
|