Fixed inconsistency between HasIntField and IntField (#2813)

This commit is contained in:
Frederick Roth
2017-05-17 00:25:30 +02:00
committed by Daniel Nelson
parent bfeb3020a3
commit ac5ac3161f
14 changed files with 50 additions and 32 deletions

View File

@@ -317,6 +317,24 @@ func (a *Accumulator) HasField(measurement string, field string) bool {
// HasIntField returns true if the measurement has an Int value
func (a *Accumulator) HasIntField(measurement string, field string) bool {
a.Lock()
defer a.Unlock()
for _, p := range a.Metrics {
if p.Measurement == measurement {
for fieldname, value := range p.Fields {
if fieldname == field {
_, ok := value.(int)
return ok
}
}
}
}
return false
}
// HasInt64Field returns true if the measurement has an Int64 value
func (a *Accumulator) HasInt64Field(measurement string, field string) bool {
a.Lock()
defer a.Unlock()
for _, p := range a.Metrics {