requestid

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package requestid is used to add/extract a request identifier to/from a context.Context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(ctx context.Context, in, out http.Header) context.Context

Extract the request id from the X-Request-ID header from 'in'. If it does not exist, it is generated as a V4 UUID. The X-Request-ID is then set on 'out'. The returned context contains the request id and if tracing is enabled the request id is added to the current span.

func FromContext

func FromContext(ctx context.Context) string

FromContext obtains a request id from a context.

func ToContext

func ToContext(ctx context.Context, id string) context.Context

ToContext adds a request id to a context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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