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
|
@ -6,6 +6,7 @@ import (
|
|||
_ "github.com/docker/containerd/services/content"
|
||||
_ "github.com/docker/containerd/services/execution"
|
||||
_ "github.com/docker/containerd/services/healthcheck"
|
||||
_ "github.com/docker/containerd/services/metrics"
|
||||
_ "github.com/docker/containerd/snapshot/btrfs"
|
||||
_ "github.com/docker/containerd/snapshot/overlay"
|
||||
)
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
gocontext "golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
|
@ -296,7 +297,10 @@ func loadSnapshotter(store *content.Store) (snapshot.Snapshotter, error) {
|
|||
}
|
||||
|
||||
func newGRPCServer() *grpc.Server {
|
||||
s := grpc.NewServer(grpc.UnaryInterceptor(interceptor))
|
||||
s := grpc.NewServer(
|
||||
grpc.UnaryInterceptor(interceptor),
|
||||
grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor),
|
||||
)
|
||||
return s
|
||||
}
|
||||
|
||||
|
@ -365,7 +369,7 @@ func interceptor(ctx gocontext.Context,
|
|||
default:
|
||||
fmt.Printf("unknown GRPC server type: %#v\n", info.Server)
|
||||
}
|
||||
return handler(ctx, req)
|
||||
return grpc_prometheus.UnaryServerInterceptor(ctx, req, info, handler)
|
||||
}
|
||||
|
||||
func handleSignals(signals chan os.Signal, server *grpc.Server) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue