Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCORSMiddleware ¶
func NewCORSMiddleware(allowedOrigins string) mux.MiddlewareFunc
func NewLogRequestMiddleware ¶
func NewLogRequestMiddleware(logger *zap.Logger) mux.MiddlewareFunc
NewLogRequestMiddleware logs important debugging information about the incoming request like its `method`, the `host`, the `url` and the `headers`.
func NewTracingLoggingMiddleware ¶
func NewTracingLoggingMiddleware(logger *zap.Logger) mux.MiddlewareFunc
NewTracingLoggingMiddleware adds a request specific logger containing the `trace_id` of the request extracted from the request propagation mechanism HTTP handlers can then easily extract a request specific logger using:
`logging.Logger(request.Context(), zlog)`
Types ¶
type RandomTraceGetter ¶
type RandomTraceGetter struct{}
RandomTrace is a fallback to insert a random trace ID if none was acquired from previous header lookups
func (RandomTraceGetter) Extract ¶
func (p RandomTraceGetter) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context
Extract gives you a context with random TraceID and SpanID inserted if it didn't exist yet
func (RandomTraceGetter) Fields ¶
func (p RandomTraceGetter) Fields() []string
Fields returns an empty list in RandomTraceGetter
func (RandomTraceGetter) Inject ¶
func (p RandomTraceGetter) Inject(ctx context.Context, carrier propagation.TextMapCarrier)
Inject does not inject anything in RandomTraceGetter