Package teststat provides helpers for testing metrics backends.
This section is empty.
View Sourcevar ( Count = 12345 Mean = 500 Stdev = 25 )
func ExpectedObservationsLessThan(bucket int64) int64
ExpectedObservationsLessThan returns the number of observations that should have a value less than or equal to the given value, given a normal distribution of observations described by Count, Mean, and Stdev.
FillCounter puts some deltas through the counter and returns the total value.
LastLine expects a regex whose first capture group can be parsed as a float64. It will dump the WriterTo and parse each line, expecting to find a match. It returns the final captured float.
PopulateNormalHistogram makes a series of normal random observations into the histogram. The number of observations is determined by Count. The randomness is determined by Mean, Stdev, and the seed parameter.
This is a low-level function, exported only for metrics that don't perform dynamic quantile computation, like a Prometheus Histogram (c.f. Summary). In most cases, you don't need to use this function, and can use TestHistogram instead.
Quantiles expects a regex whose first capture group can be parsed as a float64. It will dump the WriterTo and parse each line, expecting to find a match. It observes all captured floats into a generic.Histogram with the given number of buckets, and returns the 50th, 90th, 95th, and 99th quantiles from that histogram.
SumLines expects a regex whose first capture group can be parsed as a float64. It will dump the WriterTo and parse each line, expecting to find a match. It returns the sum of all captured floats.
TestCounter puts some deltas through the counter, and then calls the value func to check that the counter has the correct final value.
TestGauge puts some values through the gauge, and then calls the value func to check that the gauge has the correct final value.
TestHistogram puts some observations through the histogram, and then calls the quantiles func to checks that the histogram has computed the correct quantiles within some tolerance
This section is empty.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4