Documentation
¶
Index ¶
- Constants
- func GetTraceID(ctx context.Context) string
- func WithExistingOrNewTraceID(ctx context.Context) context.Context
- func WithTraceID(ctx context.Context, traceID string) context.Context
- func WithTraceIDAndLogger(ctx context.Context) context.Context
- func WithTraceIDLogger(ctx context.Context) context.Context
- type ConnectionIDContextKey
- type LoggerContextKey
- type RequestContextKey
- type TraceIDContextKey
Constants ¶
View Source
const ( LoggerKey LoggerContextKey = "logger" TraceIDKey TraceIDContextKey = "traceId" TraceIDHeader string = "X-Trace-Id" RequestSettingsKey RequestContextKey = "requestSettings" ConnectionIDKey ConnectionIDContextKey = "connectionId" )
Variables ¶
This section is empty.
Functions ¶
func GetTraceID ¶ added in v0.27.5
GetTraceID retrieves the trace ID from the context. If no trace ID is present, it returns an empty string.
func WithExistingOrNewTraceID ¶ added in v0.27.5
WithExistingOrNewTraceID returns a context with a trace ID. If the context already has a trace ID, it is reused.
func WithTraceID ¶ added in v0.27.5
WithTraceID returns a context with the provided trace ID.
func WithTraceIDAndLogger ¶ added in v0.27.6
WithTraceIDAndLogger returns a context with a trace ID (existing or new) and a logger that includes the trace ID.
Types ¶
type ConnectionIDContextKey ¶
type ConnectionIDContextKey string
type LoggerContextKey ¶
type LoggerContextKey string
type RequestContextKey ¶
type RequestContextKey string
type TraceIDContextKey ¶ added in v0.27.2
type TraceIDContextKey string
Click to show internal directories.
Click to hide internal directories.