Skip to content

Commit

Permalink
Update grpc telemetry instrumentation with new APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Doherty <[email protected]>
  • Loading branch information
chrisdoherty4 committed Jan 17, 2024
1 parent 5fa1e9a commit 41b9317
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 28151c0d0a1641bf938a7672c500e01d
commit: a86849a25cc04f4dbe9b15ddddfbc488
6 changes: 1 addition & 5 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ func NewClientConn(authority string, tls bool) (*grpc.ClientConn, error) {
creds = grpc.WithTransportCredentials(insecure.NewCredentials())
}

conn, err := grpc.Dial(authority,
creds,
grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()),
grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()),
)
conn, err := grpc.Dial(authority, creds, grpc.WithStatsHandler(otelgrpc.NewClientHandler()))
if err != nil {
return nil, errors.Wrap(err, "dial tinkerbell server")
}
Expand Down
11 changes: 3 additions & 8 deletions internal/grpcserver/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ type Registrar interface {
// SetupGRPC opens a listener and serves a given Registrar's APIs on a gRPC server and returns the listener's address or an error.
func SetupGRPC(ctx context.Context, r Registrar, listenAddr string, errCh chan<- error) (string, error) {
params := []grpc.ServerOption{
grpc.ChainUnaryInterceptor(
grpcprometheus.UnaryServerInterceptor,
otelgrpc.UnaryServerInterceptor(),
),
grpc.ChainStreamInterceptor(
grpcprometheus.StreamServerInterceptor,
otelgrpc.StreamServerInterceptor(),
),
grpc.StatsHandler(otelgrpc.NewServerHandler()),
grpc.UnaryInterceptor(grpcprometheus.UnaryServerInterceptor),
grpc.StreamInterceptor(grpcprometheus.StreamServerInterceptor),
}

// register servers
Expand Down

0 comments on commit 41b9317

Please sign in to comment.