Cache and expire metrics for prometheus output (#2016)

* Cache and expire metrics for prometheus output

* Fix test

* Use interval.Duration

* Default prometheus expiration interval to 60s

* Update changelog
This commit is contained in:
Mike Ragalie
2016-11-15 06:33:39 -05:00
committed by Cameron Sparr
parent f816b952cf
commit ff67a4b96c
4 changed files with 123 additions and 29 deletions

View File

@@ -202,6 +202,17 @@ func (a *Accumulator) AssertContainsFields(
assert.Fail(t, msg)
}
func (a *Accumulator) AssertDoesNotContainMeasurement(t *testing.T, measurement string) {
a.Lock()
defer a.Unlock()
for _, p := range a.Metrics {
if p.Measurement == measurement {
msg := fmt.Sprintf("found unexpected measurement %s", measurement)
assert.Fail(t, msg)
}
}
}
// HasIntValue returns true if the measurement has an Int value
func (a *Accumulator) HasIntField(measurement string, field string) bool {
a.Lock()