types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 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 ErrBackendError = merry.New("error fetching data from backend").WithHTTPCode(http.StatusServiceUnavailable)
View Source
var ErrConcurrencyLimitNotSet = merry.New("concurrency limit is not set")
View Source
var ErrFailed = merry.New("failed due to error")
View Source
var ErrFailedToFetch = merry.New("failed to fetch data from server/group")
View Source
var ErrForbidden = merry.New("forbidden").WithHTTPCode(http.StatusForbidden)
View Source
var ErrMaxTriesExceeded = merry.New("max tries exceeded")
View Source
var ErrNoMetricsFetched = merry.New("no metrics in the Response").WithHTTPCode(http.StatusNotFound)
View Source
var ErrNoRequests = merry.New("no requests to fetch")
View Source
var ErrNoResponseFetched = merry.New("no responses fetched from upstream")
View Source
var ErrNoServersSpecified = merry.New("no servers specified")
View Source
var ErrNoTagSpecified = merry.New("no tag specified")
View Source
var ErrNonFatalErrors = merry.New("response contains non-fatal errors")
View Source
var ErrNotFound = merry.New("metric not found")
View Source
var ErrNotImplementedYet = merry.New("this feature is not implemented yet")
View Source
var ErrNotSupportedByBackend = merry.New("this feature is not supported by backend")
View Source
var ErrResponceError = merry.New("error while fetching Response")
View Source
var ErrResponseLengthMismatch = merry.New("response length mismatch")
View Source
var ErrResponseStartTimeMismatch = merry.New("response start time mismatch")
View Source
var ErrResponseStepTimeMismatch = merry.New("response step time mismatch")
View Source
var ErrResponseTypeMismatch = merry.New("type for the response doesn't match what's expected")
View Source
var ErrTimeoutExceeded = merry.New("timeout while fetching Response").WithHTTPCode(http.StatusGatewayTimeout)
View Source
var ErrUnknownLBMethodFmt = "unknown lb method: '%v', supported: %v"
View Source
var ErrUnmarshalFailed = merry.New("unmarshal failed")

Functions

func MergeFetchResponses

func MergeFetchResponses(m1, m2 *protov3.FetchResponse) merry.Error

func NoAnswerBackends

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

func ReturnNonNotFoundError

func ReturnNonNotFoundError(errors []merry.Error) []merry.Error

Types

type BackendServer

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

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

	List(ctx context.Context) (*protov3.ListMetricsResponse, *Stats, merry.Error)
	Stats(ctx context.Context) (*protov3.MetricDetailsResponse, *Stats, merry.Error)

	ProbeTLDs(ctx context.Context) ([]string, merry.Error)

	TagNames(ctx context.Context, query string, limit int64) ([]string, merry.Error)
	TagValues(ctx context.Context, query string, limit int64) ([]string, merry.Error)

	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"`
	ForceAttemptHTTP2         bool                   `mapstructure:"forceAttemptHTTP2"`
	DoMultipleRequestsIfSplit bool                   `mapstructure:"doMultipleRequestsIfSplit"`
}

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, merry.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, merry.Error)

type MultiGlobRequestV3

type MultiGlobRequestV3 struct {
	protov3.MultiGlobRequest
}

func (MultiGlobRequestV3) LogInfo

func (request MultiGlobRequestV3) LogInfo() interface{}

func (MultiGlobRequestV3) Marshal

func (request MultiGlobRequestV3) Marshal() ([]byte, merry.Error)

type MultiMetricsInfoV3

type MultiMetricsInfoV3 struct {
	protov3.MultiMetricsInfoRequest
}

func (MultiMetricsInfoV3) LogInfo

func (request MultiMetricsInfoV3) LogInfo() interface{}

func (MultiMetricsInfoV3) Marshal

func (request MultiMetricsInfoV3) Marshal() ([]byte, merry.Error)

type Request

type Request interface {
	Marshal() ([]byte, merry.Error)
	LogInfo() interface{}
}

type ServerFetchResponse

type ServerFetchResponse struct {
	Server   string
	Response *protov3.MultiFetchResponse
	Stats    *Stats
	Err      []merry.Error
}

func NewServerFetchResponse

func NewServerFetchResponse() *ServerFetchResponse

func (*ServerFetchResponse) AddError

func (s *ServerFetchResponse) AddError(err merry.Error)

func (*ServerFetchResponse) Errors

func (first *ServerFetchResponse) Errors() []merry.Error

func (ServerFetchResponse) GetServer

func (s ServerFetchResponse) GetServer() string

func (*ServerFetchResponse) Merge

func (first *ServerFetchResponse) Merge(second *ServerFetchResponse) merry.Error

func (*ServerFetchResponse) MergeI

func (first *ServerFetchResponse) MergeI(second ServerFetcherResponse) merry.Error

func (*ServerFetchResponse) NonFatalError

func (s *ServerFetchResponse) NonFatalError(err merry.Error) *ServerFetchResponse

func (*ServerFetchResponse) Self

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

type ServerFetcherResponse

type ServerFetcherResponse interface {
	Self() interface{}
	MergeI(second ServerFetcherResponse) merry.Error
	AddError(err merry.Error)
	Errors() []merry.Error
	GetServer() string
}

func DoRequest

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

Helper function

type ServerFindResponse

type ServerFindResponse struct {
	Server   string
	Response *protov3.MultiGlobResponse
	Stats    *Stats
	Err      []merry.Error
}

func NewServerFindResponse

func NewServerFindResponse() *ServerFindResponse

func (*ServerFindResponse) AddError

func (s *ServerFindResponse) AddError(err merry.Error)

func (*ServerFindResponse) Errors

func (first *ServerFindResponse) Errors() []merry.Error

func (ServerFindResponse) GetServer

func (s ServerFindResponse) GetServer() string

func (*ServerFindResponse) Merge

func (first *ServerFindResponse) Merge(second *ServerFindResponse) merry.Error

func (*ServerFindResponse) MergeI

func (first *ServerFindResponse) MergeI(second ServerFetcherResponse) merry.Error

func (*ServerFindResponse) Self

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

type ServerInfoResponse

type ServerInfoResponse struct {
	Server   string
	Response *protov3.ZipperInfoResponse
	Stats    *Stats
	Err      []merry.Error
}

func NewServerInfoResponse

func NewServerInfoResponse() *ServerInfoResponse

func (*ServerInfoResponse) AddError

func (s *ServerInfoResponse) AddError(err merry.Error)

func (*ServerInfoResponse) Errors

func (first *ServerInfoResponse) Errors() []merry.Error

func (ServerInfoResponse) GetServer

func (s ServerInfoResponse) GetServer() string

func (*ServerInfoResponse) Merge

func (first *ServerInfoResponse) Merge(second *ServerInfoResponse) merry.Error

func (*ServerInfoResponse) MergeI

func (first *ServerInfoResponse) MergeI(second ServerFetcherResponse) merry.Error

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      []merry.Error
}

func NewServerTagResponse

func NewServerTagResponse() *ServerTagResponse

func (*ServerTagResponse) AddError

func (s *ServerTagResponse) AddError(err merry.Error)

func (*ServerTagResponse) Errors

func (first *ServerTagResponse) Errors() []merry.Error

func (ServerTagResponse) GetServer

func (s ServerTagResponse) GetServer() string

func (*ServerTagResponse) Merge

func (first *ServerTagResponse) Merge(second *ServerTagResponse) merry.Error

func (*ServerTagResponse) MergeI

func (first *ServerTagResponse) MergeI(second ServerFetcherResponse) merry.Error

func (*ServerTagResponse) Self

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

type Stats

type Stats struct {
	Timeouts          int64
	FindRequests      int64
	FindErrors        int64
	FindTimeouts      int64
	RenderRequests    int64
	RenderErrors      int64
	RenderTimeouts    int64
	InfoRequests      int64
	InfoErrors        int64
	InfoTimeouts      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