-
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(serializers.csv): Allow specifying fixed column order (#14870)
- Loading branch information
Showing
11 changed files
with
200 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Example for outputting CSV with a specified column order | ||
# | ||
# Output File: | ||
# testcases/ordered.csv | ||
# | ||
# Input: | ||
# mymetric,machine=A1,host=1cbbb3796fc2 pressure=987.5,temperature=23.7,hours=15i 1653643420000000000 | ||
# mymetric,machine=X9,host=83d2e491ca01 pressure=1022.6,temperature=39.9,hours=231i 1653646789000000000 | ||
|
||
csv_timestamp_format = "unix_ns" | ||
csv_columns = ["timestamp", "field.temperature", "field.pressure", "tag.machine"] |
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 @@ | ||
1653643420000000000,23.7,987.5,A1 | ||
1653646789000000000,39.9,1022.6,X9 |
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 @@ | ||
# Example for outputting CSV with a specified column order | ||
# | ||
# Output File: | ||
# testcases/ordered_not_exist.csv | ||
# | ||
# Input: | ||
# mymetric,machine=A1,host=1cbbb3796fc2 pressure=987.5,temperature=23.7,hours=15i 1653643420000000000 | ||
# mymetric,machine=X9,host=83d2e491ca01 status="healthy",pressure=1022.6,temperature=39.9,hours=231i 1653646789000000000 | ||
|
||
csv_timestamp_format = "unix_ns" | ||
csv_header = true | ||
csv_columns = ["timestamp", "field.temperature", "field.pressure", "field.status", "tag.location", "tag.machine"] |
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,3 @@ | ||
timestamp,temperature,pressure,status,location,machine | ||
1653643420000000000,23.7,987.5,,,A1 | ||
1653646789000000000,39.9,1022.6,healthy,,X9 |
12 changes: 12 additions & 0 deletions
12
plugins/serializers/csv/testcases/ordered_with_header.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 @@ | ||
# Example for outputting CSV with a specified column order | ||
# | ||
# Output File: | ||
# testcases/ordered_with_header.csv | ||
# | ||
# Input: | ||
# mymetric,machine=A1,host=1cbbb3796fc2 pressure=987.5,temperature=23.7,hours=15i 1653643420000000000 | ||
# mymetric,machine=X9,host=83d2e491ca01 pressure=1022.6,temperature=39.9,hours=231i 1653646789000000000 | ||
|
||
csv_timestamp_format = "unix_ns" | ||
csv_header = true | ||
csv_columns = ["timestamp", "field.temperature", "field.pressure", "tag.machine"] |
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,3 @@ | ||
timestamp,temperature,pressure,machine | ||
1653643420000000000,23.7,987.5,A1 | ||
1653646789000000000,39.9,1022.6,X9 |
13 changes: 13 additions & 0 deletions
13
plugins/serializers/csv/testcases/ordered_with_header_prefix.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 @@ | ||
# Example for outputting CSV with a specified column order | ||
# | ||
# Output File: | ||
# testcases/ordered_with_header_prefix.csv | ||
# | ||
# Input: | ||
# mymetric,machine=A1,host=1cbbb3796fc2 pressure=987.5,temperature=23.7,hours=15i 1653643420000000000 | ||
# mymetric,machine=X9,host=83d2e491ca01 pressure=1022.6,temperature=39.9,hours=231i 1653646789000000000 | ||
|
||
csv_timestamp_format = "unix_ns" | ||
csv_header = true | ||
csv_column_prefix = true | ||
csv_columns = ["timestamp", "field.temperature", "field.pressure", "tag.machine"] |
3 changes: 3 additions & 0 deletions
3
plugins/serializers/csv/testcases/ordered_with_header_prefix.csv
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,3 @@ | ||
timestamp,field_temperature,field_pressure,tag_machine | ||
1653643420000000000,23.7,987.5,A1 | ||
1653646789000000000,39.9,1022.6,X9 |