-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parsers.xpath): Add support for returning underlying data-types (#…
- Loading branch information
Showing
18 changed files
with
200 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
native_types value_a="a string",value_b=3.1415,value_c=42.0,value_d=true |
13 changes: 13 additions & 0 deletions
13
plugins/parsers/xpath/testcases/native_types_json/telegraf.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[inputs.file]] | ||
files = ["./testcases/native_types_json/test.json"] | ||
data_format = "xpath_json" | ||
xpath_native_types = true | ||
|
||
[[inputs.file.xpath]] | ||
metric_name = "'native_types'" | ||
[inputs.file.xpath.fields] | ||
value_a = "//a" | ||
value_b = "//b" | ||
value_c = "//c" | ||
value_d = "//d" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"a": "a string", | ||
"b": 3.1415, | ||
"c": 42, | ||
"d": true | ||
} |
1 change: 1 addition & 0 deletions
1
plugins/parsers/xpath/testcases/native_types_msgpack/expected.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
native_types value_a="a string",value_b=3.1415,value_c=42.0,value_d=true |
1 change: 1 addition & 0 deletions
1
plugins/parsers/xpath/testcases/native_types_msgpack/native_types_json/expected.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
native_types value_a="a string",value_b=3.1415,value_c=true |
12 changes: 12 additions & 0 deletions
12
plugins/parsers/xpath/testcases/native_types_msgpack/native_types_json/telegraf.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[[inputs.file]] | ||
files = ["./testcases/native_types_json/test.json"] | ||
data_format = "xpath_json" | ||
xpath_native_types = true | ||
|
||
[[inputs.file.xpath]] | ||
metric_name = "'native_types'" | ||
[inputs.file.xpath.fields] | ||
value_a = "//a" | ||
value_b = "//b" | ||
value_c = "//c" | ||
|
5 changes: 5 additions & 0 deletions
5
plugins/parsers/xpath/testcases/native_types_msgpack/native_types_json/test.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"a": "a string", | ||
"b": 3.1415, | ||
"c": true | ||
} |
13 changes: 13 additions & 0 deletions
13
plugins/parsers/xpath/testcases/native_types_msgpack/telegraf.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[inputs.file]] | ||
files = ["./testcases/native_types_msgpack/test.msg"] | ||
data_format = "xpath_msgpack" | ||
xpath_native_types = true | ||
|
||
[[inputs.file.xpath]] | ||
metric_name = "'native_types'" | ||
[inputs.file.xpath.fields] | ||
value_a = "//a" | ||
value_b = "//b" | ||
value_c = "//c" | ||
value_d = "//d" | ||
|
Binary file not shown.
1 change: 1 addition & 0 deletions
1
plugins/parsers/xpath/testcases/native_types_protobuf/expected.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
native_types value_a="a string",value_b=3.1415,value_c=42i,value_d=true |
10 changes: 10 additions & 0 deletions
10
plugins/parsers/xpath/testcases/native_types_protobuf/message.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
|
||
package native_type; | ||
|
||
message Message { | ||
string a = 1; | ||
double b = 2; | ||
int32 c = 3; | ||
bool d = 4; | ||
} |
17 changes: 17 additions & 0 deletions
17
plugins/parsers/xpath/testcases/native_types_protobuf/telegraf.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[[inputs.file]] | ||
files = ["./testcases/native_types_protobuf/test.dat"] | ||
data_format = "xpath_protobuf" | ||
xpath_native_types = true | ||
|
||
xpath_protobuf_file = "message.proto" | ||
xpath_protobuf_type = "native_type.Message" | ||
xpath_protobuf_import_paths = [".", "./testcases/native_types_protobuf"] | ||
|
||
[[inputs.file.xpath]] | ||
metric_name = "'native_types'" | ||
[inputs.file.xpath.fields] | ||
value_a = "//a" | ||
value_b = "//b" | ||
value_c = "//c" | ||
value_d = "//d" | ||
|
2 changes: 2 additions & 0 deletions
2
plugins/parsers/xpath/testcases/native_types_protobuf/test.dat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
a stringo���! @* |