Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser processor #4551

Merged
merged 24 commits into from
Aug 22, 2018
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove tests that handle parsing tags
  • Loading branch information
Ayrdrie Palmer committed Aug 9, 2018
commit 38733c1f42febefebd3b6a55878e38ffe19d5100
56 changes: 1 addition & 55 deletions plugins/processors/fieldparser/fieldparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func Metric(v telegraf.Metric, err error) telegraf.Metric {
func TestApply(t *testing.T) {
tests := []struct {
name string
parseTags []string
parseFields []string
config parsers.Config
input telegraf.Metric
Expand Down Expand Up @@ -130,61 +131,6 @@ func TestApply(t *testing.T) {
time.Unix(0, 0))),
},
},
{
name: "parse one tag",
config: parsers.Config{
DataFormat: "logfmt",
},
input: Metric(
metric.New(
"success",
map[string]string{},
map[string]interface{}{
"test_name": `ts=2018-07-24T19:43:40.275Z`,
},
time.Unix(0, 0))),
expected: []telegraf.Metric{
Metric(metric.New(
"success",
map[string]string{},
map[string]interface{}{
"test_name": `ts=2018-07-24T19:43:40.275Z`,
},
time.Unix(0, 0))),
Metric(metric.New(
"success",
map[string]string{},
map[string]interface{}{
"ts": "2018-07-24T19:43:40.275Z",
},
time.Unix(0, 0))),
},
},
{
name: "parse two tags",
config: parsers.Config{
DataFormat: "logfmt",
},
input: Metric(
metric.New(
"success",
map[string]string{},
map[string]interface{}{
"timestamp": `ts=2018-07-24T19:43:40.275Z`,
"message": `msg="http request"`,
},
time.Unix(0, 0))),
expected: []telegraf.Metric{
Metric(metric.New(
"success",
map[string]string{},
map[string]interface{}{
"timestamp": `ts=2018-07-24T19:43:40.275Z`,
"message": `msg="http request"`,
},
time.Unix(0, 0))),
},
},
{
name: "Fail to parse fields but still parses tag",
config: parsers.Config{
Expand Down