MCPcopy
hub / github.com/prometheus/client_golang / getBounds

Function getBounds

prometheus/summary_test.go:410–426  ·  view source on GitHub ↗
(vars []float64, q, ε float64)

Source from the content-addressed store, hash-verified

408}
409
410func getBounds(vars []float64, q, ε float64) (minBound, maxBound float64) {
411 // TODO(beorn7): This currently tolerates an error of up to 2*ε. The
412 // error must be at most ε, but for some reason, it's sometimes slightly
413 // higher. That's a bug.
414 n := float64(len(vars))
415 lower := int((q - 2*ε) * n)
416 upper := int(math.Ceil((q + 2*ε) * n))
417 minBound = vars[0]
418 if lower > 1 {
419 minBound = vars[lower-1]
420 }
421 maxBound = vars[len(vars)-1]
422 if upper < len(vars) {
423 maxBound = vars[upper-1]
424 }
425 return
426}
427
428func TestSummaryVecCreatedTimestampWithDeletes(t *testing.T) {
429 for _, tcase := range []struct {

Callers 2

TestSummaryConcurrencyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected