forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parsers.avro): Allow union fields to be specified as tags (influ…
- Loading branch information
Showing
4 changed files
with
89 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Switch,switch_wwn=10:00:50:EB:1A:0B:84:3A,some_union_in_a_tag=some_value statistics_collection_time=1682509200092i,up_time=1166984904i,memory_utilization=20.0 1682509200092000 |
14 changes: 14 additions & 0 deletions
14
plugins/parsers/avro/testcases/union-nullable-tag/message.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,14 @@ | ||
{ | ||
"some_union_in_a_tag": { | ||
"string": "some_value" | ||
}, | ||
"switch_wwn": "10:00:50:EB:1A:0B:84:3A", | ||
"statistics_collection_time": 1682509200092, | ||
"up_time": 1166984904, | ||
"cpu_utilization": { | ||
"null": null | ||
}, | ||
"memory_utilization": { | ||
"float": 20.0 | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
plugins/parsers/avro/testcases/union-nullable-tag/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,27 @@ | ||
[[ inputs.file ]] | ||
files = ["./testcases/union-nullable-tag/message.json"] | ||
data_format = "avro" | ||
|
||
avro_format = "json" | ||
avro_measurement = "Switch" | ||
avro_tags = ["switch_wwn", "some_union_in_a_tag"] | ||
avro_fields = ["up_time", "cpu_utilization", "memory_utilization", "statistics_collection_time"] | ||
avro_timestamp = "statistics_collection_time" | ||
avro_timestamp_format = "unix_ms" | ||
avro_union_mode = "nullable" | ||
avro_schema = ''' | ||
{ | ||
"namespace": "com.brocade.streaming", | ||
"name": "fibrechannel_switch_statistics", | ||
"type": "record", | ||
"version": "1", | ||
"fields": [ | ||
{"name": "some_union_in_a_tag", "type": ["null", "string"], "default": null, "doc": "Some union that is used in a tag"}, | ||
{"name": "switch_wwn", "type": "string", "doc": "WWN of the Physical Switch."}, | ||
{"name": "statistics_collection_time", "type": "long", "doc": "Epoch time when statistics is collected."}, | ||
{"name": "up_time", "type": "long", "doc": "Switch Up Time (in hundredths of a second)"}, | ||
{"name": "cpu_utilization", "type": ["null","float"], "default": null, "doc": "CPU Utilization in %"}, | ||
{"name": "memory_utilization", "type": ["null", "float"], "default": null, "doc": "Memory Utilization in %"} | ||
] | ||
} | ||
''' |