graphite

package
v0.0.0-...-15fa731 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResults

type CheckResults struct {
	Valid []int // each position corresponds to a validator
	// categories of invalid responses
	Empty      int
	Timeout    int
	Other      int
	FirstOther *Response
}

final outcome of check results

func CheckMT

func CheckMT(endpoints []int, query, from string, dur time.Duration, reqs int, validators ...Validator) CheckResults

checkMT queries all provided MT endpoints and provides a summary of all the outcomes; meaning the counts of each response matching each validator function, and the number of timeouts, and finally all others (non-timeouting invalid responses) we recommend for 60s duration to use 6000 requests, e.g. 100 per second

type Comparator

type Comparator func(p float64) bool

func Eq

func Eq(good float64) Comparator

func Ge

func Ge(good float64) Comparator

type Data

type Data []Series

type Point

type Point struct {
	Val float64
	Ts  uint32
}

func (*Point) UnmarshalJSON

func (p *Point) UnmarshalJSON(data []byte) error

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response is a convenience type: it provides original http and json decode errors, if applicable and also the decoded response body, if any

func RetryGraphite

func RetryGraphite(query, from string, times int, validate Validator) (bool, Response)

func RetryGraphite8080

func RetryGraphite8080(query, from string, times int, validate Validator) (bool, Response)

func RetryMT

func RetryMT(query, from string, times int, validate Validator) (bool, Response)

type Series

type Series struct {
	Target     string
	Datapoints []Point
}

type Validator

type Validator func(resp Response) bool

func ValidateCode

func ValidateCode(code int) Validator

ValidaterCode returns a validator that validates whether the response has the given code

func ValidateCorrect

func ValidateCorrect(num float64) Validator

ValidateCorrect returns a validator with a min number, which will validate whether we received a "sufficiently correct" response. We assume the response corresponds to a sumSeries() query of multiple series, typically across shards across different instances. the number denotes the minimum accepted value. e.g. with 12, all points must equal 12 (i.e. for the use case of 12 series (1 for each shard, and each series valued at 1) all data from all shards is incorporated) to allow 4 shards being down and unaccounted for, pass 8. NOTE: 8 points are ignored (see comments further down) so you should only call this for sufficiently long series, e.g. 15 points or so.

func ValidateTargets

func ValidateTargets(targets []string) Validator

ValidateTargets returns a function that validates that the response contains exactly all named targets

func ValidatorAvgWindowed

func ValidatorAvgWindowed(numPoints int, cmp Comparator) Validator

ValidatorAvgWindowed returns a validator that validates the number of series and the avg value of each series it is windowed to allow the dataset to include one or two values that would be evened out by a value just outside of the response. For example: response: NaN 4 4 4 5 3 4 4 4 5 clearly here we can trust that if the avg value should be 4, that there would be a 3 coming after the response but we don't want to wait for that. NOTE: ignores up to 2 points from each series, adjust your input size accordingly for desired confidence

func ValidatorLenNulls

func ValidatorLenNulls(prefix, l int) Validator

ValidatorLenNulls returns a validator that validates that any of the series contained within the response, has a length of l and no more than prefix nulls up front.

Jump to

Keyboard shortcuts

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