types

package
v0.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyMsg = &empty.Empty{}
View Source
var ErrFailedToFetchFmt = "failed to fetch data from server group %v, code %v, body %v"
View Source
var ErrMaxTriesExceeded = errors.New("max tries exceeded")
View Source
var ErrNoMetricsFetched = errors.New("no metrics in the Response")
View Source
var ErrNoResponseFetched = errors.New("no responses fetched from upstream")
View Source
var ErrNonFatalErrors = errors.New("response contains non-fatal errors")
View Source
var ErrNotFound = errors.New("metric not found")
View Source
var ErrNotImplementedYet = errors.New("this feature is not implemented yet")
View Source
var ErrNotSupportedByBackend = errors.New("this feature is not supported by backend")
View Source
var ErrResponseLengthMismatch = errors.New("response length mismatch")
View Source
var ErrResponseStartTimeMismatch = errors.New("response start time mismatch")
View Source
var ErrResponseStepTimeMismatch = errors.New("response step time mismatch")
View Source
var ErrTimeoutExceeded = errors.New("timeout while fetching Response")
View Source
var ErrUnknownLBMethodFmt = "unknown lb method: '%v', supported: %v"

Functions

func MergeFetchResponses

func MergeFetchResponses(m1, m2 *protov3.FetchResponse) *errors.Errors

func NoAnswerBackends

func NoAnswerBackends(backends []BackendServer, answered map[string]struct{}) []string

Types

type BackendServer

type BackendServer interface {
	Name() string
	Backends() []string
	MaxMetricsPerRequest() int

	Fetch(ctx context.Context, request *protov3.MultiFetchRequest) (*protov3.MultiFetchResponse, *Stats, *errors.Errors)
	Find(ctx context.Context, request *protov3.MultiGlobRequest) (*protov3.MultiGlobResponse, *Stats, *errors.Errors)
	Info(ctx context.Context, request *protov3.MultiMetricsInfoRequest) (*protov3.ZipperInfoResponse, *Stats, *errors.Errors)

	List(ctx context.Context) (*protov3.ListMetricsResponse, *Stats, *errors.Errors)
	Stats(ctx context.Context) (*protov3.MetricDetailsResponse, *Stats, *errors.Errors)

	ProbeTLDs(ctx context.Context) ([]string, *errors.Errors)

	TagNames(ctx context.Context, query string, limit int64) ([]string, *errors.Errors)
	TagValues(ctx context.Context, query string, limit int64) ([]string, *errors.Errors)

	Children() []BackendServer
}

type BackendV2

type BackendV2 struct {
	GroupName           string                 `mapstructure:"groupName"`
	Protocol            string                 `mapstructure:"protocol"`
	LBMethod            string                 `mapstructure:"lbMethod"` // Valid: rr/roundrobin, broadcast/all
	Servers             []string               `mapstructure:"servers"`
	Timeouts            *Timeouts              `mapstructure:"timeouts"`
	ConcurrencyLimit    *int                   `mapstructure:"concurrencyLimit"`
	KeepAliveInterval   *time.Duration         `mapstructure:"keepAliveInterval"`
	MaxIdleConnsPerHost *int                   `mapstructure:"maxIdleConnsPerHost"`
	MaxTries            *int                   `mapstructure:"maxTries"`
	MaxBatchSize        int                    `mapstructure:"maxBatchSize"`
	BackendOptions      map[string]interface{} `mapstructure:"backendOptions"`
}

func (*BackendV2) FillDefaults

func (b *BackendV2) FillDefaults()

type BackendsV2

type BackendsV2 struct {
	Backends                  []BackendV2   `mapstructure:"backends"`
	MaxIdleConnsPerHost       int           `mapstructure:"maxIdleConnsPerHost"`
	ConcurrencyLimitPerServer int           `mapstructure:"concurrencyLimit"`
	Timeouts                  Timeouts      `mapstructure:"timeouts"`
	KeepAliveInterval         time.Duration `mapstructure:"keepAliveInterval"`
	MaxTries                  int           `mapstructure:"maxTries"`
	MaxBatchSize              int           `mapstructure:"maxBatchSize"`
}

type CapabilityRequestV3

type CapabilityRequestV3 struct {
	protov3.CapabilityRequest
}

func (CapabilityRequestV3) LogInfo

func (request CapabilityRequestV3) LogInfo() interface{}

func (CapabilityRequestV3) Marshal

func (request CapabilityRequestV3) Marshal() ([]byte, error)

type CarbonSearch

type CarbonSearch struct {
	Backend string `mapstructure:"backend"`
	Prefix  string `mapstructure:"prefix"`
}

CarbonSearch is a structure that contains carbonsearch related configuration bits

type CarbonSearchV2

type CarbonSearchV2 struct {
	BackendsV2
	Prefix string `mapstructure:"prefix"`
}

type Fetcher

type Fetcher func(ctx context.Context, logger *zap.Logger, client BackendServer, reqs interface{}, resCh chan ServerFetcherResponse)

type Fetcher func(ctx context.Context, logger *zap.Logger, client types.BackendServer, reqs interface{}, resCh chan<- types.ServerFetchResponse) { type Fetcher func(ctx context.Context, logger *zap.Logger, client BackendServer, reqs interface{}, resCh chan ServerFetchResponse) {

type LBMethod

type LBMethod int
const (
	RoundRobinLB LBMethod = iota
	BroadcastLB
)

func (*LBMethod) FromString

func (m *LBMethod) FromString(method string) error

func (LBMethod) MarshalJSON

func (m LBMethod) MarshalJSON() ([]byte, error)

func (*LBMethod) UnmarshalJSON

func (m *LBMethod) UnmarshalJSON(data []byte) error

func (*LBMethod) UnmarshalYAML

func (m *LBMethod) UnmarshalYAML(unmarshal func(interface{}) error) error

type MultiFetchRequestV3

type MultiFetchRequestV3 struct {
	protov3.MultiFetchRequest
}

func (MultiFetchRequestV3) LogInfo

func (request MultiFetchRequestV3) LogInfo() interface{}

func (MultiFetchRequestV3) Marshal

func (request MultiFetchRequestV3) Marshal() ([]byte, error)

type MultiGlobRequestV3

type MultiGlobRequestV3 struct {
	protov3.MultiGlobRequest
}

func (MultiGlobRequestV3) LogInfo

func (request MultiGlobRequestV3) LogInfo() interface{}

func (MultiGlobRequestV3) Marshal

func (request MultiGlobRequestV3) Marshal() ([]byte, error)

type MultiMetricsInfoV3

type MultiMetricsInfoV3 struct {
	protov3.MultiMetricsInfoRequest
}

func (MultiMetricsInfoV3) LogInfo

func (request MultiMetricsInfoV3) LogInfo() interface{}

func (MultiMetricsInfoV3) Marshal

func (request MultiMetricsInfoV3) Marshal() ([]byte, error)

type Request

type Request interface {
	Marshal() ([]byte, error)
	LogInfo() interface{}
}

type ServerFetchResponse

type ServerFetchResponse struct {
	Server   string
	Response *protov3.MultiFetchResponse
	Stats    *Stats
	Err      *errors.Errors
}

func NewServerFetchResponse

func NewServerFetchResponse() *ServerFetchResponse

func (*ServerFetchResponse) Errors

func (first *ServerFetchResponse) Errors() *errors.Errors

func (ServerFetchResponse) GetServer

func (s ServerFetchResponse) GetServer() string

func (*ServerFetchResponse) Merge

func (first *ServerFetchResponse) Merge(second *ServerFetchResponse) *errors.Errors

func (*ServerFetchResponse) MergeI

func (first *ServerFetchResponse) MergeI(second ServerFetcherResponse) *errors.Errors

func (*ServerFetchResponse) NonFatalError

func (s *ServerFetchResponse) NonFatalError(err error) *ServerFetchResponse

func (*ServerFetchResponse) Self

func (s *ServerFetchResponse) Self() interface{}

type ServerFetcherResponse

type ServerFetcherResponse interface {
	Self() interface{}
	MergeI(second ServerFetcherResponse) *errors.Errors
	Errors() *errors.Errors
	GetServer() string
}

func DoRequest

func DoRequest(ctx context.Context, logger *zap.Logger, clients []BackendServer, result ServerFetcherResponse, requests interface{}, fetcher Fetcher) (ServerFetcherResponse, int)

Helper function

type ServerFindResponse

type ServerFindResponse struct {
	Server   string
	Response *protov3.MultiGlobResponse
	Stats    *Stats
	Err      *errors.Errors
}

func NewServerFindResponse

func NewServerFindResponse() *ServerFindResponse

func (*ServerFindResponse) Errors

func (first *ServerFindResponse) Errors() *errors.Errors

func (ServerFindResponse) GetServer

func (s ServerFindResponse) GetServer() string

func (*ServerFindResponse) Merge

func (first *ServerFindResponse) Merge(second *ServerFindResponse) *errors.Errors

func (*ServerFindResponse) MergeI

func (first *ServerFindResponse) MergeI(second ServerFetcherResponse) *errors.Errors

func (*ServerFindResponse) Self

func (s *ServerFindResponse) Self() interface{}

type ServerInfoResponse

type ServerInfoResponse struct {
	Server   string
	Response *protov3.ZipperInfoResponse
	Stats    *Stats
	Err      *errors.Errors
}

func NewServerInfoResponse

func NewServerInfoResponse() *ServerInfoResponse

func (*ServerInfoResponse) Errors

func (first *ServerInfoResponse) Errors() *errors.Errors

func (ServerInfoResponse) GetServer

func (s ServerInfoResponse) GetServer() string

func (*ServerInfoResponse) Merge

func (first *ServerInfoResponse) Merge(second *ServerInfoResponse) *errors.Errors

func (*ServerInfoResponse) MergeI

func (first *ServerInfoResponse) MergeI(second ServerFetcherResponse) *errors.Errors

func (*ServerInfoResponse) Self

func (s *ServerInfoResponse) Self() interface{}

type ServerResponse

type ServerResponse struct {
	Server   string
	Response []byte
}

type ServerTagResponse

type ServerTagResponse struct {
	Server   string
	Response []string
	Err      *errors.Errors
}

func NewServerTagResponse

func NewServerTagResponse() *ServerTagResponse

func (*ServerTagResponse) Errors

func (first *ServerTagResponse) Errors() *errors.Errors

func (ServerTagResponse) GetServer

func (s ServerTagResponse) GetServer() string

func (*ServerTagResponse) Merge

func (first *ServerTagResponse) Merge(second *ServerTagResponse) *errors.Errors

func (*ServerTagResponse) MergeI

func (first *ServerTagResponse) MergeI(second ServerFetcherResponse) *errors.Errors

func (*ServerTagResponse) Self

func (s *ServerTagResponse) Self() interface{}

type Stats

type Stats struct {
	Timeouts          int64
	FindErrors        int64
	RenderErrors      int64
	InfoErrors        int64
	SearchRequests    int64
	SearchCacheHits   int64
	SearchCacheMisses int64
	ZipperRequests    int64
	TotalMetricsCount int64

	MemoryUsage int64

	CacheMisses int64
	CacheHits   int64

	Servers       []string
	FailedServers []string
}

Stats provides zipper-related statistics

func (*Stats) Merge

func (s *Stats) Merge(stats *Stats)

type Timeouts

type Timeouts struct {
	Find    time.Duration `yaml:"find"`
	Render  time.Duration `yaml:"render"`
	Connect time.Duration `yaml:"connect"`
}

Timeouts is a global structure that contains configuration for zipper Timeouts

Jump to

Keyboard shortcuts

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