MCPcopy Create free account
hub / github.com/cortexproject/cortex / timeEpsilonCorrect

Function timeEpsilonCorrect

pkg/testexporter/correctness/simple.go:188–195  ·  view source on GitHub ↗
(f func(time.Time) float64, pair model.SamplePair, testTimeEpsilon time.Duration)

Source from the content-addressed store, hash-verified

186}
187
188func timeEpsilonCorrect(f func(time.Time) float64, pair model.SamplePair, testTimeEpsilon time.Duration) bool {
189 minExpected := f(pair.Timestamp.Time().Add(-testTimeEpsilon))
190 maxExpected := f(pair.Timestamp.Time().Add(testTimeEpsilon))
191 if minExpected > maxExpected {
192 minExpected, maxExpected = maxExpected, minExpected
193 }
194 return minExpected < float64(pair.Value) && float64(pair.Value) < maxExpected
195}
196
197func valueEpsilonCorrect(f func(time.Time) float64, pair model.SamplePair, testEpsilon float64) bool {
198 return epsilonCorrect(float64(pair.Value), f(pair.Timestamp.Time()), testEpsilon)

Callers 1

verifySamplesFunction · 0.85

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected