Add name, time, path and string field options to JSON parser (#4351)
This commit is contained in:
@@ -26,7 +26,11 @@ func TestHTTPwithJSONFormat(t *testing.T) {
|
||||
URLs: []string{url},
|
||||
}
|
||||
metricName := "metricName"
|
||||
p, _ := parsers.NewJSONParser(metricName, nil, nil)
|
||||
|
||||
p, _ := parsers.NewParser(&parsers.Config{
|
||||
DataFormat: "json",
|
||||
MetricName: "metricName",
|
||||
})
|
||||
plugin.SetParser(p)
|
||||
|
||||
var acc testutil.Accumulator
|
||||
@@ -63,8 +67,11 @@ func TestHTTPHeaders(t *testing.T) {
|
||||
URLs: []string{url},
|
||||
Headers: map[string]string{header: headerValue},
|
||||
}
|
||||
metricName := "metricName"
|
||||
p, _ := parsers.NewJSONParser(metricName, nil, nil)
|
||||
|
||||
p, _ := parsers.NewParser(&parsers.Config{
|
||||
DataFormat: "json",
|
||||
MetricName: "metricName",
|
||||
})
|
||||
plugin.SetParser(p)
|
||||
|
||||
var acc testutil.Accumulator
|
||||
@@ -83,7 +90,10 @@ func TestInvalidStatusCode(t *testing.T) {
|
||||
}
|
||||
|
||||
metricName := "metricName"
|
||||
p, _ := parsers.NewJSONParser(metricName, nil, nil)
|
||||
p, _ := parsers.NewParser(&parsers.Config{
|
||||
DataFormat: "json",
|
||||
MetricName: metricName,
|
||||
})
|
||||
plugin.SetParser(p)
|
||||
|
||||
var acc testutil.Accumulator
|
||||
@@ -105,8 +115,10 @@ func TestMethod(t *testing.T) {
|
||||
Method: "POST",
|
||||
}
|
||||
|
||||
metricName := "metricName"
|
||||
p, _ := parsers.NewJSONParser(metricName, nil, nil)
|
||||
p, _ := parsers.NewParser(&parsers.Config{
|
||||
DataFormat: "json",
|
||||
MetricName: "metricName",
|
||||
})
|
||||
plugin.SetParser(p)
|
||||
|
||||
var acc testutil.Accumulator
|
||||
|
||||
Reference in New Issue
Block a user