Documentation
¶
Index ¶
- Constants
- func Auth() gin.HandlerFunc
- func AuthAdmin() gin.HandlerFunc
- func Cors() gin.HandlerFunc
- func GetRequestIDFromContext(c *gin.Context) string
- func GetRequestIDFromHeaders(c *gin.Context) string
- func Logging(opts ...Option) gin.HandlerFunc
- func RequestID() gin.HandlerFunc
- func Tracing(serviceName string, opts ...TraceOption) gin.HandlerFunc
- type Option
- type TraceOption
Constants ¶
const ( // ContextRequestIDKey context request id for context ContextRequestIDKey = "request_id" // HeaderXRequestIDKey http header request ID key HeaderXRequestIDKey = "X-Request-ID" )
Variables ¶
This section is empty.
Functions ¶
func GetRequestIDFromContext ¶ added in v1.3.1
GetRequestIDFromContext returns 'RequestID' from the given context if present.
func GetRequestIDFromHeaders ¶ added in v1.3.1
GetRequestIDFromHeaders returns 'RequestID' from the headers if present.
func RequestID ¶ added in v1.3.1
func RequestID() gin.HandlerFunc
RequestID is a middleware that injects a 'X-Request-ID' into the context and request/response header of each request.
func Tracing ¶ added in v1.3.0
func Tracing(serviceName string, opts ...TraceOption) gin.HandlerFunc
Tracing returns middleware that will trace incoming requests. The service parameter should describe the name of the (virtual) server handling the request.
Types ¶
type Option ¶
type Option func(*options)
Option set the gin logger options.
func WithIgnoreRoutes ¶
WithIgnoreRoutes no logger content routes
func WithRequestIDFromContext ¶ added in v1.3.2
WithRequestIDFromContext name is field in context, default value is request_id
func WithRequestIDFromHeader ¶ added in v1.3.2
WithRequestIDFromHeader name is field in header, default value is X-Request-Id
type TraceOption ¶ added in v1.3.1
type TraceOption func(*traceConfig)
TraceOption specifies instrumentation configuration options.
func WithPropagators ¶ added in v1.3.0
func WithPropagators(propagators propagation.TextMapPropagator) TraceOption
WithPropagators specifies propagators to use for extracting information from the HTTP requests. If none are specified, global ones will be used.
func WithTracerProvider ¶ added in v1.3.0
func WithTracerProvider(provider oteltrace.TracerProvider) TraceOption
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.