fix timestamp parsing on prometheus plugin (#2596)

This commit is contained in:
djjorjinho
2017-03-29 23:04:29 +01:00
committed by Daniel Nelson
parent 2d7f612bd7
commit cc5b2f68b6
4 changed files with 26 additions and 5 deletions

View File

@@ -275,6 +275,19 @@ func (a *Accumulator) AssertDoesNotContainMeasurement(t *testing.T, measurement
}
}
// HasTimestamp returns true if the measurement has a matching Time value
func (a *Accumulator) HasTimestamp(measurement string, timestamp time.Time) bool {
a.Lock()
defer a.Unlock()
for _, p := range a.Metrics {
if p.Measurement == measurement {
return timestamp.Equal(p.Time)
}
}
return false
}
// HasIntField returns true if the measurement has an Int value
func (a *Accumulator) HasIntField(measurement string, field string) bool {
a.Lock()