cache: add client telemetry (#975)

This commit is contained in:
Travis Groth 2020-06-22 18:18:44 -04:00 committed by GitHub
parent 24b523c043
commit 88a77c42bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 77 additions and 9 deletions

15
cache/cache.go vendored
View file

@ -19,6 +19,7 @@ import (
"github.com/pomerium/pomerium/internal/grpc/user"
"github.com/pomerium/pomerium/internal/identity"
"github.com/pomerium/pomerium/internal/identity/manager"
"github.com/pomerium/pomerium/internal/telemetry"
"github.com/pomerium/pomerium/internal/urlutil"
)
@ -52,9 +53,19 @@ func New(opts config.Options) (*Cache, error) {
if err != nil {
return nil, err
}
// No metrics handler because we have one in the control plane. Add one
// if we no longer register with that grpc Server
localGRPCServer := grpc.NewServer()
localGRPCConnection, err := grpc.DialContext(context.Background(), localListener.Addr().String(),
grpc.WithInsecure())
clientStatsHandler := telemetry.NewGRPCClientStatsHandler(opts.Services)
clientDialOptions := clientStatsHandler.DialOptions(grpc.WithInsecure())
localGRPCConnection, err := grpc.DialContext(
context.Background(),
localListener.Addr().String(),
clientDialOptions...,
)
if err != nil {
return nil, err
}