requestid

package
v0.15.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package requestid has functions for working with x-request-id in http/gRPC requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

FromContext gets the request id from a context.

func FromHTTPHeader

func FromHTTPHeader(hdr http.Header) string

FromHTTPHeader returns the request id in the HTTP header. If no request id exists, an empty string is returned.

func HTTPMiddleware

func HTTPMiddleware() func(next http.Handler) http.Handler

HTTPMiddleware creates a new http middleware that populates the request id.

func New

func New() string

New creates a new 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.

func WithValue

func WithValue(parent context.Context, requestID string) context.Context

WithValue returns a new context from the parent context with a request id value set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL