Fixed inconsistency between HasIntField and IntField (#2813)
This commit is contained in:
committed by
Daniel Nelson
parent
bfeb3020a3
commit
ac5ac3161f
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user