Skip to content

Commit

Permalink
ctx WithValue (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalderdak committed Jun 25, 2024
1 parent 0680e91 commit 78403ec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ctxtrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,8 @@ func packCallerMetadata(m *metadata.MD, data TraceData) {
m.Set(headerRequestID, data.RequestID)
}
}

// WithValue Creates context with TraceData values
func WithValue(ctx context.Context, traceData TraceData) context.Context {
return context.WithValue(ctx, traceCtxMarker{}, traceData)
}

0 comments on commit 78403ec

Please sign in to comment.