requestid

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

The requestid package creates a middleware the generates and injects a unique request id into the request context and response header.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) string

Tries to get the request id from the request context.

func LogHandler

func LogHandler(key string) middleware

LogHandler adds a zerolog/hlog middleware handler to inject the request id into the log context with the desired key.

func New

func New(opts ...option) middleware

Returns a new requestid middleware with the requested options.

func WithGenerator

func WithGenerator(g generator) option

Override the ID generation function which defaults to a v4 UUID.

func WithHeader

func WithHeader(h string) option

Override the request id header from the default "X-Request-ID".

Types

This section is empty.

Jump to

Keyboard shortcuts

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