Fix handling of uint64 in datadog output (#4091)
This commit is contained in:
parent
916e9ab815
commit
55818e791d
|
@ -179,13 +179,9 @@ func verifyValue(v interface{}) bool {
|
||||||
|
|
||||||
func (p *Point) setValue(v interface{}) error {
|
func (p *Point) setValue(v interface{}) error {
|
||||||
switch d := v.(type) {
|
switch d := v.(type) {
|
||||||
case int:
|
|
||||||
p[1] = float64(int(d))
|
|
||||||
case int32:
|
|
||||||
p[1] = float64(int32(d))
|
|
||||||
case int64:
|
case int64:
|
||||||
p[1] = float64(int64(d))
|
p[1] = float64(d)
|
||||||
case float32:
|
case uint64:
|
||||||
p[1] = float64(d)
|
p[1] = float64(d)
|
||||||
case float64:
|
case float64:
|
||||||
p[1] = float64(d)
|
p[1] = float64(d)
|
||||||
|
@ -195,7 +191,7 @@ func (p *Point) setValue(v interface{}) error {
|
||||||
p[1] = float64(1)
|
p[1] = float64(1)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("undeterminable type")
|
return fmt.Errorf("undeterminable field type: %T", v)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,30 @@ func TestBuildPoint(t *testing.T) {
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
testutil.TestMetric(int64(0), "test int64"),
|
||||||
|
Point{
|
||||||
|
float64(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC).Unix()),
|
||||||
|
0.0,
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testutil.TestMetric(uint64(0), "test uint64"),
|
||||||
|
Point{
|
||||||
|
float64(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC).Unix()),
|
||||||
|
0.0,
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testutil.TestMetric(true, "test bool"),
|
||||||
|
Point{
|
||||||
|
float64(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC).Unix()),
|
||||||
|
1.0,
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tagtests {
|
for _, tt := range tagtests {
|
||||||
pt, err := buildMetrics(tt.ptIn)
|
pt, err := buildMetrics(tt.ptIn)
|
||||||
|
|
Loading…
Reference in New Issue