util

package
v0.0.0-...-6ebec13 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyRequestID = "x-request-id"
)

Variables

This section is empty.

Functions

func EnsureRequestID

func EnsureRequestID(r *http.Request) string

EnsureRequestID retrieves the value of the X-Request-Id header. If not found it will generate a new one and set the header accordingly. Returns the resulting id.

func GetRequestID

func GetRequestID(r *http.Request) string

GetRequestID retrieves the request id from the request context

func NewRequestID

func NewRequestID() string

NewRequestID generates a new request id

func RequestContext

func RequestContext(r *http.Request) context.Context

RequestContext generates a new context that includes a request id

func WithID

func WithID(name string, r *http.Request) logr.Logger

WithID returns a logr.Logger with a name and request id added to the log context

Types

This section is empty.

Jump to

Keyboard shortcuts

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