Documentation ¶
Index ¶
- func RequestForLocalTesting(base, target, from string) *http.Request
- func RequestForLocalTestingGraphite(target, from string) *http.Request
- func RequestForLocalTestingGraphite8080(target, from string) *http.Request
- func RequestForLocalTestingMT(target, from string) *http.Request
- type CheckResults
- type Comparator
- type Data
- type Point
- type Response
- type Series
- type Validator
- func ValidateCode(code int) Validator
- func ValidateCorrect(num float64) Validator
- func ValidateTargets(targets []string) Validator
- func ValidatorAnd(vals ...Validator) Validator
- func ValidatorAndExhaustive(vals ...Validator) Validator
- func ValidatorAvgWindowed(numPoints int, cmp Comparator) Validator
- func ValidatorLenNulls(prefix, l int) Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestForLocalTesting ¶ added in v0.13.0
func RequestForLocalTestingGraphite ¶ added in v0.13.0
func RequestForLocalTestingGraphite8080 ¶ added in v0.13.0
func RequestForLocalTestingMT ¶ added in v0.13.0
Types ¶
type CheckResults ¶
type CheckResults struct { Validators []Validator 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 ¶
func Eq ¶
func Eq(good float64) Comparator
Eq returns a comparator that checks whether a float equals the given float
func Ge ¶
func Ge(good float64) Comparator
Eq returns a comparator that checks whether a float is bigger or equal than the given float (or both are NaN)
type Point ¶
func (*Point) UnmarshalJSON ¶
type Response ¶
type Response struct { HTTPErr error DecodeErr error Code int TraceID string Decoded Data BodyErr string // set if we could not decode json }
Response is a convenience type: it provides original http and json decode errors, if applicable and also the decoded response body, if any
func ExecuteRenderQuery ¶ added in v0.13.0
func (Response) StringWithoutData ¶ added in v0.13.0
type Validator ¶
func ValidateCode ¶
ValidaterCode returns a validator that validates whether the response has the given code
func ValidateCorrect ¶
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 ¶
ValidateTargets returns a function that validates that the response contains exactly all named targets
func ValidatorAnd ¶ added in v0.13.0
ValidatorAnd returns a validator that returns whether all given validators return true it runs them in the order given and returns as soon as one fails.
func ValidatorAndExhaustive ¶ added in v0.13.0
ValidatorAndExhaustive returns a validator that returns whether all given validators return true it runs them in the order given, always runs all of them, and prints a log at each run showing the intermediate status
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 ¶
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.