service

package
v0.0.0-...-3f61646 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2019 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

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

func CacheValue(method interface{}, req client.Request, rsp interface{}) error

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 NewTrace

func NewTrace(opts ...trace.Option) trace.Trace

func StartPprof

func StartPprof()

Types

type CacheKeyFunc

type CacheKeyFunc func(req client.Request) string

CacheKeyFunc generates the cache key

type CacheManager

type CacheManager struct {
	// contains filtered or unexported fields
}
var (
	CacheMgrIns *CacheManager
	RedisClient *redis.Client
)

type CacheSetting

type CacheSetting struct {
	Method     interface{}
	Expiration time.Duration
	AnonOnly   bool
}

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

type FallbackFunc func(req client.Request, rsp interface{}, err error) error

FallbackFunc defines the API fallback, receives the response as parameter, and returns a hystrix's fallback.

type MetricsClientWrapper

type MetricsClientWrapper struct {
	client.Client
}

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) GetGauge

func (mm *MetricsManager) GetGauge(id string) metrics.Gauge

func (*MetricsManager) GetHistogram

func (mm *MetricsManager) GetHistogram(id string) metrics.Histogram

func (*MetricsManager) UpdateConcurrency

func (mm *MetricsManager) UpdateConcurrency(id string, change int) int

Directories

Path Synopsis
metrics
Package etcdv3 provides an etcd version 3 registry
Package etcdv3 provides an etcd version 3 registry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL