fix(dt-output): remove hardcoded int value (#9676)
This commit is contained in:
parent
8daba8aa19
commit
0ce9c2e9f6
|
|
@ -287,7 +287,7 @@ func getTypeOption(metricType telegraf.ValueType, field *telegraf.Field) dtMetri
|
|||
case uint64:
|
||||
return dtMetric.WithIntGaugeValue(int64(v))
|
||||
case int64:
|
||||
return dtMetric.WithIntGaugeValue(32)
|
||||
return dtMetric.WithIntGaugeValue(v)
|
||||
case bool:
|
||||
if v {
|
||||
return dtMetric.WithIntGaugeValue(1)
|
||||
|
|
|
|||
|
|
@ -353,11 +353,11 @@ func TestSendMetricWithDefaultDimensions(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
bodyString := string(bodyBytes)
|
||||
// use regex because field order isn't guaranteed
|
||||
require.Equal(t, len(bodyString), 79)
|
||||
require.Equal(t, len(bodyString), 78)
|
||||
require.Regexp(t, regexp.MustCompile("^mymeasurement.value"), bodyString)
|
||||
require.Regexp(t, regexp.MustCompile("dt.metrics.source=telegraf"), bodyString)
|
||||
require.Regexp(t, regexp.MustCompile("dim=value"), bodyString)
|
||||
require.Regexp(t, regexp.MustCompile("gauge,32 1289430000000$"), bodyString)
|
||||
require.Regexp(t, regexp.MustCompile("gauge,2 1289430000000$"), bodyString)
|
||||
err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`)
|
||||
require.NoError(t, err)
|
||||
}))
|
||||
|
|
@ -378,7 +378,7 @@ func TestSendMetricWithDefaultDimensions(t *testing.T) {
|
|||
m1 := metric.New(
|
||||
"mymeasurement",
|
||||
map[string]string{},
|
||||
map[string]interface{}{"value": 32},
|
||||
map[string]interface{}{"value": 2},
|
||||
time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue