Documentation
¶
Index ¶
- Constants
- Variables
- func Allowz(_ string) gin.HandlerFunc
- func Cors(_ string) gin.HandlerFunc
- func IsAllow(c *gin.Context) bool
- func ListPlugins() []string
- func Logging(_ string) gin.HandlerFunc
- func MetricsFunc(_ string) gin.HandlerFunc
- func Recovery(_ string) gin.HandlerFunc
- func Register(plugin *Instance)
- func RequestInfo(_ string) gin.HandlerFunc
- func TracingFunc(serviceName string) gin.HandlerFunc
- type AllowConfig
- type Instance
- type Instances
- type String
- type TraceOption
Constants ¶
View Source
const ( ALLOW = "ALLOW" ALLOWWEIGHT = 90 )
View Source
const ( CORS = "CORS" CORSWEIGHT = 50 )
View Source
const ( ACCESSLOG = "ACCESSLOG" ACCESSLOGWEIGHT = 101 STACKLOG = "STACKLOG" STACKLOGWEIGHT = 102 )
View Source
const ( METRICS = "METRICS" METRICSWEIGHT = 80 )
View Source
const ( REQUESTINFO = "REQUESTINFO" REQUESTINFOWEIGHT = 120 )
View Source
const ( TRACING = "TRACING" TRACINGWEIGHT = 130 )
Variables ¶
View Source
var ( ErrMiddlewareRegisterNil = fmt.Errorf("middleware: Register adapter is nil") ErrMiddlewareDoubleRegister = fmt.Errorf("middleware: Register called twice for adapter: ") )
Functions ¶
func Allowz ¶
func Allowz(_ string) gin.HandlerFunc
func MetricsFunc ¶
func MetricsFunc(_ string) gin.HandlerFunc
func Recovery ¶
func Recovery(_ string) gin.HandlerFunc
func RequestInfo ¶
func RequestInfo(_ string) gin.HandlerFunc
func TracingFunc ¶ added in v1.3.0
func TracingFunc(serviceName string) gin.HandlerFunc
TracingFunc returns interceptor that will trace incoming requests. The service parameter should describe the name of the (virtual) server handling the request.
Types ¶
type AllowConfig ¶
type Instance ¶
type Instance struct { F func(servicename string) gin.HandlerFunc // middle instance Weight uint // plugin load weight 越大到越靠前load Name string // plugin name }
func AllMiddlewarePlugins ¶
func AllMiddlewarePlugins() []*Instance
type TraceOption ¶ added in v1.3.0
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.
Click to show internal directories.
Click to hide internal directories.