Skip to content

Commit

Permalink
Add the opentelemetry interceptor to the stream chain as well
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Dec 19, 2023
1 parent ef4c163 commit 412c5a6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pkg/rgrpc/rgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,20 +371,23 @@ func (s *Server) getInterceptors(unprotected []string) ([]grpc.ServerOption, err
return nil, errors.Wrap(err, "rgrpc: error creating stream auth interceptor")
}

streamInterceptors := []grpc.StreamServerInterceptor{authStream}
for _, t := range streamTriples {
streamInterceptors = append(streamInterceptors, t.Interceptor)
s.log.Info().Msgf("rgrpc: chaining grpc streaming interceptor %s with priority %d", t.Name, t.Priority)
}

streamInterceptors = append([]grpc.StreamServerInterceptor{
authStream,
streamInterceptors := []grpc.StreamServerInterceptor{
otelgrpc.StreamServerInterceptor(
otelgrpc.WithTracerProvider(s.tracerProvider),
otelgrpc.WithPropagators(rtrace.Propagator),
),
appctx.NewStream(s.log, s.tracerProvider),
token.NewStream(),
useragent.NewStream(),
log.NewStream(),
recovery.NewStream(),
}, streamInterceptors...)
authStream,
}

for _, t := range streamTriples {
streamInterceptors = append(streamInterceptors, t.Interceptor)
s.log.Info().Msgf("rgrpc: chaining grpc streaming interceptor %s with priority %d", t.Name, t.Priority)
}
streamChain := grpc_middleware.ChainStreamServer(streamInterceptors...)

opts := []grpc.ServerOption{
Expand Down

0 comments on commit 412c5a6

Please sign in to comment.