Documentation ¶
Index ¶
- Variables
- func AddCorrelationLogger(ctx context.Context) context.Context
- func AddHeadersFromContext(ctx context.Context, req *http.Request)
- func CreateCtxFromRequest(req *http.Request) context.Context
- func GetActivityID(ctx context.Context) string
- func GetCorrelationID(ctx context.Context) string
- func SetActivityID(ctx context.Context, activityID string) context.Context
- func SetCorrelationID(ctx context.Context, correlationID string) context.Context
- type ContextMatadataHeaders
Constants ¶
This section is empty.
Variables ¶
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 ¶
AddCorrelationLogger adds the correlation information to the context logger
func AddHeadersFromContext ¶
AddHeadersFromContext Add metadata headers from the context into the request headers only adds headers that are not already set.
func CreateCtxFromRequest ¶
CreateCtxFromRequest serialize http request headers into a context
func GetActivityID ¶
GetActivityID gets the activity ID from a context
func GetCorrelationID ¶
GetCorrelationID gets the correlation ID from a context
func SetActivityID ¶
SetActivityID sets the current activity ID in the context or generates a new one
Types ¶
type ContextMatadataHeaders ¶
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 ¶
func (m ContextMatadataHeaders) Get(key string) string
Get returns the value related to the given key.