Documentation ¶
Index ¶
- Constants
- func FromContext(ctx context.Context) (string, bool)
- func HandleRequestID(ctx context.Context) (reqID string)
- func NewContext(ctx context.Context, reqID string) context.Context
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
Constants ¶
View Source
const ( DeprecatedRequestIDKey = "Request-Id" DefaultRequestIDKey = "X-Request-ID" RequestIDLogKey = "request_id" )
DefaultRequestIDKey is the metadata key name for request ID
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the Request-Id information from ctx if it exists.
func HandleRequestID ¶ added in v0.19.2
HandleRequestID either extracts a existing and valid request ID from the context or generates a new one
func NewContext ¶
NewContext creates a new context with Request-Id attached if not exists.
func StreamServerInterceptor ¶ added in v0.17.1
func StreamServerInterceptor() grpc.StreamServerInterceptor
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns grpc.UnaryServerInterceptor that should be used as a middleware to generate/include Request-Id in headers and context for tracing and tracking user's request.
Returned middleware populates Request-Id from gRPC metadata if they defined in a testRequest message else creates a new one.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.