Add grpc prometheus metrics
This provideds generic grpc metrics via prometheus Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
a85c28d248
commit
f9212348e4
11 changed files with 921 additions and 2 deletions
26
services/metrics/metrics.go
Normal file
26
services/metrics/metrics.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"github.com/docker/containerd/plugin"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
plugin.Register("metrics-grpc", &plugin.Registration{
|
||||
Type: plugin.GRPCPlugin,
|
||||
Init: New,
|
||||
})
|
||||
}
|
||||
|
||||
func New(_ *plugin.InitContext) (interface{}, error) {
|
||||
return &Service{}, nil
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
}
|
||||
|
||||
func (s *Service) Register(server *grpc.Server) error {
|
||||
grpc_prometheus.Register(server)
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue