reqid

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package reqid creates request IDs and stores them in Contexts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoreIDFromContext

func CoreIDFromContext(ctx context.Context) string

CoreIDFromContext returns the Chain-Core-ID stored in ctx, or the empty string.

func FromContext

func FromContext(ctx context.Context) string

FromContext returns the request ID stored in ctx, if any.

func FromSubContext

func FromSubContext(ctx context.Context) string

FromSubContext returns the sub-request ID stored in ctx, if any.

func Handler

func Handler(handler http.Handler) http.Handler

func New

func New() string

New generates a random request ID.

func NewContext

func NewContext(ctx context.Context, reqid string) context.Context

NewContext returns a new Context that carries reqid. It also adds a log prefix to print the request ID using package bytom/log.

func NewSubContext

func NewSubContext(ctx context.Context, reqid string) context.Context

func PathFromContext

func PathFromContext(ctx context.Context) string

PathFromContext returns the HTTP path stored in ctx, or the empty string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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