Documentation
¶
Index ¶
- func CallWrappers(opts ...Option) []client.CallWrapper
- func ClientWrappers(opts ...Option) []client.Wrapper
- func HandlerWrappers(opts ...Option) []server.HandlerWrapper
- func SubscriberWrappers(opts ...Option) []server.SubscriberWrapper
- type Config
- type Option
- func DisableAuth() Option
- func DisableCircuitBreaker() Option
- func DisableCors() Option
- func DisableErrorHandler() Option
- func DisableIdempotent() Option
- func DisableLogging() Option
- func DisableMetrics() Option
- func DisableRateLimiter() Option
- func DisableRequestId() Option
- func DisableSecurity() Option
- func DisableTimeout() Option
- func DisableTracing() Option
- func EnableIdempotent() Option
- func WithAuthOptions(opts ...auth.Option) Option
- func WithCircuitBreakerOptions(opts ...circuitbreaker.Option) Option
- func WithConfig(paths ...string) Option
- func WithCorsOptions(opts ...cors.Option) Option
- func WithErrorHandlerOptions(opts ...errorhandler.Option) Option
- func WithIdempotentOptions(opts ...idempotent.Option) Option
- func WithLoggingOptions(opts ...logging.Option) Option
- func WithMetricsOptions(opts ...prometheus.Option) Option
- func WithRateLimiterOptions(opts ...ratelimiter.Option) Option
- func WithRequestIdOptions(opts ...requestid.Option) Option
- func WithSecurityOptions(opts ...security.Option) Option
- func WithTimeoutOptions(opts ...timeout.Option) Option
- func WithTracingOptions(opts ...opentelemetry.Option) Option
- type Options
- type WrapperInfo
- type WrapperOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallWrappers ¶
func CallWrappers(opts ...Option) []client.CallWrapper
func HandlerWrappers ¶
func HandlerWrappers(opts ...Option) []server.HandlerWrapper
func SubscriberWrappers ¶
func SubscriberWrappers(opts ...Option) []server.SubscriberWrapper
Types ¶
type Config ¶
type Config struct {
RequestId *requestid.Config `yaml:"requestid,omitempty"`
Logging *logging.Config `yaml:"logging,omitempty"`
Metrics *prometheus.Options `yaml:"metrics,omitempty"`
Tracing *opentelemetry.Options `yaml:"tracing,omitempty"`
Security *security.Config `yaml:"security,omitempty"`
Cors *cors.Config `yaml:"cors,omitempty"`
ErrorHandler *errorhandler.Config `yaml:"error_handler,omitempty"`
Timeout *timeout.Config `yaml:"timeout,omitempty"`
Idempotent *idempotent.Config `yaml:"idempotent,omitempty"`
CircuitBreaker *circuitbreaker.Config `yaml:"circuit_breaker,omitempty"`
RateLimiter *ratelimiter.Config `yaml:"rate_limiter,omitempty"`
Auth *auth.Config `yaml:"auth,omitempty"`
}
Config holds configuration for all wrapper types loaded from config center.
type Option ¶
type Option func(*Options)
func DisableCircuitBreaker ¶
func DisableCircuitBreaker() Option
DisableCircuitBreaker disables the circuit breaker wrapper.
func DisableErrorHandler ¶
func DisableErrorHandler() Option
DisableErrorHandler disables the error handler wrapper.
func DisableIdempotent ¶
func DisableIdempotent() Option
DisableIdempotent disables the idempotent wrapper.
func DisableRateLimiter ¶
func DisableRateLimiter() Option
DisableRateLimiter disables the rate limiter wrapper.
func DisableRequestId ¶
func DisableRequestId() Option
DisableRequestId disables the request ID wrapper.
func EnableIdempotent ¶
func EnableIdempotent() Option
EnableIdempotent enables the idempotent wrapper.
func WithAuthOptions ¶
WithAuthOptions enables and configures the auth wrapper.
func WithCircuitBreakerOptions ¶
func WithCircuitBreakerOptions(opts ...circuitbreaker.Option) Option
WithCircuitBreakerOptions enables and configures the circuit breaker wrapper.
func WithConfig ¶
WithConfig loads wrapper configuration from the config center at the specified paths.
func WithCorsOptions ¶
WithCorsOptions enables and configures the CORS wrapper.
func WithErrorHandlerOptions ¶
func WithErrorHandlerOptions(opts ...errorhandler.Option) Option
WithErrorHandlerOptions enables and configures the error handler wrapper.
func WithIdempotentOptions ¶
func WithIdempotentOptions(opts ...idempotent.Option) Option
WithIdempotentOptions enables and configures the idempotent wrapper.
func WithLoggingOptions ¶
WithLoggingOptions enables and configures the logging wrapper.
func WithMetricsOptions ¶
func WithMetricsOptions(opts ...prometheus.Option) Option
WithMetricsOptions enables and configures the metrics wrapper.
func WithRateLimiterOptions ¶
func WithRateLimiterOptions(opts ...ratelimiter.Option) Option
WithRateLimiterOptions enables and configures the rate limiter wrapper.
func WithRequestIdOptions ¶
WithRequestIdOptions enables and configures the request ID wrapper.
func WithSecurityOptions ¶
WithSecurityOptions enables and configures the security wrapper.
func WithTimeoutOptions ¶
WithTimeoutOptions enables and configures the timeout wrapper.
func WithTracingOptions ¶
func WithTracingOptions(opts ...opentelemetry.Option) Option
WithTracingOptions enables and configures the tracing wrapper.
type Options ¶
type Options struct {
RequestId WrapperOption[requestid.Option]
Logging WrapperOption[logging.Option]
Metrics WrapperOption[prometheus.Option]
Tracing WrapperOption[opentelemetry.Option]
Security WrapperOption[security.Option]
Cors WrapperOption[cors.Option]
ErrorHandler WrapperOption[errorhandler.Option]
Timeout WrapperOption[timeout.Option]
Idempotent WrapperOption[idempotent.Option]
CircuitBreaker WrapperOption[circuitbreaker.Option]
RateLimiter WrapperOption[ratelimiter.Option]
Auth WrapperOption[auth.Option]
}
Options holds configuration for all available wrappers.
type WrapperInfo ¶
type WrapperInfo struct {
// Name is the unique identifier of the wrapper (e.g., "logging", "tracing").
Name string
// Type indicates the wrapper category: "client", "call", "handler", or "subscriber".
Type string
// Enabled indicates whether this wrapper is currently active.
Enabled bool
// Order is the execution priority (lower numbers execute first).
Order int
}
WrapperInfo describes an active wrapper in the chain.
func ActiveWrappers ¶
func ActiveWrappers(opts ...Option) []WrapperInfo
ActiveWrappers returns information about all configured wrappers and their status. The result is organized by wrapper type and execution order.
func ActiveWrappersByType ¶
func ActiveWrappersByType(wrapperType string, opts ...Option) []WrapperInfo
ActiveWrappersByType returns wrapper information filtered by type. The wrapperType parameter accepts: "client", "call", "handler", or "subscriber".
func EnabledWrappers ¶
func EnabledWrappers(opts ...Option) []WrapperInfo
EnabledWrappers returns only the enabled wrappers.
Source Files
¶
- options.go
- wrappers.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package circuitbreaker provides circuit breaker middleware for go-micro services.
|
Package circuitbreaker provides circuit breaker middleware for go-micro services. |
|
Package idempotent provides idempotency middleware for go-micro services.
|
Package idempotent provides idempotency middleware for go-micro services. |
|
metric
|
|
|
prometheus
Package prometheus provides Prometheus metrics wrappers for micro services.
|
Package prometheus provides Prometheus metrics wrappers for micro services. |
|
example
command
Package main shows examples of how to use the rate limiter wrapper
|
Package main shows examples of how to use the rate limiter wrapper |
|
Package wrapper injects a go-micro.Service into the context
|
Package wrapper injects a go-micro.Service into the context |
|
Package timeout provides timeout handling for go-micro services
|
Package timeout provides timeout handling for go-micro services |
|
trace
|
|