Documentation ¶
Index ¶
- Constants
- Variables
- func CacheValue(method interface{}, req client.Request, rsp interface{}) error
- func CacheWrapper(fn server.HandlerFunc) server.HandlerFunc
- func ConfigCircuitBreaker(settings []CircuitSetting)
- func ConfigRpcCache(settings []CacheSetting)
- func LogWrapper(fn server.HandlerFunc) server.HandlerFunc
- func MetricsWrapper(fn server.HandlerFunc) server.HandlerFunc
- func NewGRPCBetaService(cfg std.ConfigService) micro.Service
- func NewService(svcCfg std.ConfigService, opts ...micro.Option) micro.Service
- func NewTrace(opts ...trace.Option) trace.Trace
- func StartPprof()
- type CacheKeyFunc
- type CacheManager
- type CacheSetting
- type CircuitBreakerManager
- type CircuitSetting
- type FallbackFunc
- type MetricsClientWrapper
- type MetricsManager
- func (mm *MetricsManager) GetConcurrency(id string) int
- func (mm *MetricsManager) GetCounter(id string) metrics.Counter
- func (mm *MetricsManager) GetGauge(id string) metrics.Gauge
- func (mm *MetricsManager) GetHistogram(id string) metrics.Histogram
- func (mm *MetricsManager) UpdateConcurrency(id string, change int) int
Constants ¶
View Source
const ( UserSvcName = "solar.user" GreeterSvcName = "solar.greeter" )
Variables ¶
View Source
var ( TraceTopic = "zipkin" TraceHeader = "X-B3-TraceId" SpanHeader = "X-B3-SpanId" ParentHeader = "X-B3-ParentSpanId" SampleHeader = "X-B3-Sampled" )
Functions ¶
func CacheValue ¶
CacheValue fetches the cache for the latest successful request.
func CacheWrapper ¶
func CacheWrapper(fn server.HandlerFunc) server.HandlerFunc
func ConfigCircuitBreaker ¶
func ConfigCircuitBreaker(settings []CircuitSetting)
ConfigCircuitBreaker configures the circuit breaker's settings for multiple commands
func ConfigRpcCache ¶
func ConfigRpcCache(settings []CacheSetting)
func LogWrapper ¶
func LogWrapper(fn server.HandlerFunc) server.HandlerFunc
LogWrapper wraps the RPC handler for capturing the panic log.
func MetricsWrapper ¶
func MetricsWrapper(fn server.HandlerFunc) server.HandlerFunc
func NewGRPCBetaService ¶
func NewGRPCBetaService(cfg std.ConfigService) micro.Service
func NewService ¶
func NewService(svcCfg std.ConfigService, opts ...micro.Option) micro.Service
func StartPprof ¶
func StartPprof()
Types ¶
type CacheKeyFunc ¶
CacheKeyFunc generates the cache key
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
var ( CacheMgrIns *CacheManager RedisClient *redis.Client )
type CacheSetting ¶
type CircuitBreakerManager ¶
type CircuitBreakerManager struct {
// contains filtered or unexported fields
}
CircuitBreakerManager controls the hystrix status and settings.
var ( // CircuitBreakerMgrIns holds the global circuit breaker settings. CircuitBreakerMgrIns *CircuitBreakerManager )
type CircuitSetting ¶
type CircuitSetting struct { Method interface{} Timeout int MaxConcurrentRequests int RequestVolumeThreshold int SleepWindow int ErrorPercentThreshold int Fallback FallbackFunc CacheKey CacheKeyFunc }
CircuitSetting defines the hystrix settings for the specified command.
type FallbackFunc ¶
FallbackFunc defines the API fallback, receives the response as parameter, and returns a hystrix's fallback.
type MetricsClientWrapper ¶
MetricsClientWrapper represents the client prometheus wrapper
func (*MetricsClientWrapper) Call ¶
func (c *MetricsClientWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error
type MetricsManager ¶
type MetricsManager struct {
// contains filtered or unexported fields
}
var (
MetricsMgrIns *MetricsManager
)
func (*MetricsManager) GetConcurrency ¶
func (mm *MetricsManager) GetConcurrency(id string) int
func (*MetricsManager) GetCounter ¶
func (mm *MetricsManager) GetCounter(id string) metrics.Counter
func (*MetricsManager) GetHistogram ¶
func (mm *MetricsManager) GetHistogram(id string) metrics.Histogram
func (*MetricsManager) UpdateConcurrency ¶
func (mm *MetricsManager) UpdateConcurrency(id string, change int) int
Source Files ¶
Click to show internal directories.
Click to hide internal directories.