Skip to content

Commit

Permalink
feat: add tracing metadata in the gRPC client interceptor
Browse files Browse the repository at this point in the history
This commit introduces an enhancement to the gRPC client interceptor to add tracing metadata. This is achieved by injecting trace context and attaching it to the outgoing metadata of the client requests.
  • Loading branch information
shumkovdenis committed May 18, 2023
1 parent a933dbb commit e80b4a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion grpc/client_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func AddDaprAppID(appID string) grpc.UnaryClientInterceptor {
func AddTraceContext() grpc.UnaryClientInterceptor {
return func(ctx context.Context, method string, req, reply interface{},
cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
var carrier http.Header
carrier := make(http.Header)
trace.InjectTraceContext(ctx, carrier)
ctx = metadata.AppendToOutgoingContext(ctx,
trace.TraceparentHeader, carrier.Get(trace.TraceparentHeader))
Expand Down

0 comments on commit e80b4a8

Please sign in to comment.