Merge pull request #1967 from crosbymichael/grpc-timing
Enable grpc timing histograms
This commit is contained in:
commit
632f78a530
@ -50,7 +50,8 @@ type Debug struct {
|
|||||||
|
|
||||||
// MetricsConfig provides metrics configuration
|
// MetricsConfig provides metrics configuration
|
||||||
type MetricsConfig struct {
|
type MetricsConfig struct {
|
||||||
Address string `toml:"address"`
|
Address string `toml:"address"`
|
||||||
|
GRPCHistogram bool `toml:"grpc_histogram"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CgroupConfig provides cgroup configuration
|
// CgroupConfig provides cgroup configuration
|
||||||
|
@ -70,6 +70,7 @@ func New(ctx context.Context, config *Config) (*Server, error) {
|
|||||||
s = &Server{
|
s = &Server{
|
||||||
rpc: rpc,
|
rpc: rpc,
|
||||||
events: exchange.NewExchange(),
|
events: exchange.NewExchange(),
|
||||||
|
config: config,
|
||||||
}
|
}
|
||||||
initialized = plugin.NewPluginSet()
|
initialized = plugin.NewPluginSet()
|
||||||
)
|
)
|
||||||
@ -127,10 +128,15 @@ func New(ctx context.Context, config *Config) (*Server, error) {
|
|||||||
type Server struct {
|
type Server struct {
|
||||||
rpc *grpc.Server
|
rpc *grpc.Server
|
||||||
events *exchange.Exchange
|
events *exchange.Exchange
|
||||||
|
config *Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServeGRPC provides the containerd grpc APIs on the provided listener
|
// ServeGRPC provides the containerd grpc APIs on the provided listener
|
||||||
func (s *Server) ServeGRPC(l net.Listener) error {
|
func (s *Server) ServeGRPC(l net.Listener) error {
|
||||||
|
if s.config.Metrics.GRPCHistogram {
|
||||||
|
// enable grpc time histograms to measure rpc latencies
|
||||||
|
grpc_prometheus.EnableHandlingTimeHistogram()
|
||||||
|
}
|
||||||
// before we start serving the grpc API regster the grpc_prometheus metrics
|
// before we start serving the grpc API regster the grpc_prometheus metrics
|
||||||
// handler. This needs to be the last service registered so that it can collect
|
// handler. This needs to be the last service registered so that it can collect
|
||||||
// metrics for every other service
|
// metrics for every other service
|
||||||
|
Loading…
Reference in New Issue
Block a user