correlation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CorrelationIDHeader the correlation ID Header
	CorrelationIDHeader = "correlation-request-id"

	// UserAgentHeader the UserAgent header
	UserAgentHeader = "User-Agent"

	// AcceptedLanguageHeader the AcceptedLanguage header
	AcceptedLanguageHeader = "Accept-Language"

	// RequestIDHeader stores the request id for the request
	RequestIDHeader = "request-id"
)

Functions

func AddCorrelationLogger

func AddCorrelationLogger(ctx context.Context) context.Context

AddCorrelationLogger adds the correlation information to the context logger

func AddHeadersFromContext

func AddHeadersFromContext(ctx context.Context, req *http.Request)

AddHeadersFromContext Add metadata headers from the context into the request headers only adds headers that are not already set.

func CreateCtxFromRequest

func CreateCtxFromRequest(req *http.Request) context.Context

CreateCtxFromRequest serialize http request headers into a context

func GetActivityID

func GetActivityID(ctx context.Context) string

GetActivityID gets the activity ID from a context

func GetCorrelationID

func GetCorrelationID(ctx context.Context) string

GetCorrelationID gets the correlation ID from a context

func SetActivityID

func SetActivityID(ctx context.Context, activityID string) context.Context

SetActivityID sets the current activity ID in the context or generates a new one

func SetCorrelationID

func SetCorrelationID(ctx context.Context, correlationID string) context.Context

SetCorrelationID sets the correlation ID in the context

Types

type ContextMatadataHeaders

type ContextMatadataHeaders map[string]string

ContextMatadataHeaders stores header information into the context

func GetMetadataHeaders

func GetMetadataHeaders(ctx context.Context) ContextMatadataHeaders

GetMetadataHeaders gets the metadata headers from a context

func (ContextMatadataHeaders) Add

func (m ContextMatadataHeaders) Add(req *http.Request, key string)

Add adds non emtpy string values to the metadata

func (ContextMatadataHeaders) FromReq

func (m ContextMatadataHeaders) FromReq(req *http.Request)

FromReq populates the metadataHeader from an http request

func (ContextMatadataHeaders) Get

Get returns the value related to the given key.

Jump to

Keyboard shortcuts

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