Documentation ¶
Overview ¶
Package requestid has functions for working with x-request-id in http/gRPC requests.
Index ¶
- func FromContext(ctx context.Context) string
- func FromHTTPHeader(hdr http.Header) string
- func HTTPMiddleware() func(next http.Handler) http.Handler
- func New() string
- func NewRoundTripper(base http.RoundTripper) http.RoundTripper
- func StreamClientInterceptor() grpc.StreamClientInterceptor
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryClientInterceptor() grpc.UnaryClientInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- func WithValue(parent context.Context, requestID string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext gets the request id from a context.
func FromHTTPHeader ¶
FromHTTPHeader returns the request id in the HTTP header. If no request id exists, an empty string is returned.
func HTTPMiddleware ¶
HTTPMiddleware creates a new http middleware that populates the request id.
func NewRoundTripper ¶
func NewRoundTripper(base http.RoundTripper) http.RoundTripper
NewRoundTripper creates a new RoundTripper which adds the request id to the outgoing headers.
func StreamClientInterceptor ¶
func StreamClientInterceptor() grpc.StreamClientInterceptor
StreamClientInterceptor returns a new gRPC StreamClientInterceptor which puts the request ID in the outgoing metadata.
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor returns a new gRPC StreamServerInterceptor which populates the request id from the incoming metadata.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor() grpc.UnaryClientInterceptor
UnaryClientInterceptor returns a new gRPC UnaryClientInterceptor which puts the request ID in the outgoing metadata.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new gRPC UnaryServerInterceptor which populates the request id from the incoming metadata.
Types ¶
This section is empty.