Documentation ¶
Index ¶
- func ApplyTransport(client *http.Client)
- func FromContext(ctx context.Context) string
- func FromRequest(r *http.Request) string
- func Middleware(inner http.Handler) http.Handler
- func NewID() string
- func RequestIDLogger(logger logrus.FieldLogger, requestID string) logrus.FieldLogger
- func ToContext(ctx context.Context, requestID string) context.Context
- func Transport(inner http.RoundTripper) http.RoundTripper
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTransport ¶
ApplyTransport injects the request-id transport to an http client
func FromContext ¶
FromContext returns the request id stored in the the context
func FromRequest ¶
func Middleware ¶
Middleware wraps an http handler. Before the inner handler is called, the X-Request-ID header is extracted and injected into the request context. It is safe to be called if the header does not exists
func RequestIDLogger ¶
func RequestIDLogger(logger logrus.FieldLogger, requestID string) logrus.FieldLogger
func Transport ¶
func Transport(inner http.RoundTripper) http.RoundTripper
Transport wraps an inner transport. It adds the request-id from the request context to the request header.
Types ¶
Click to show internal directories.
Click to hide internal directories.