Feature Request
Adding this option enables the parser to process metadata included before the CSV header.
This information can be included in every metric as a field or tag.
Proposal:
To add two new options to the CSV parser: csv_metadata_rows and csv_metadata_regex
csv_metadata_rows = x where x is the number of rows that contain the metadata after csv_skip_rows and before the header rows. By default, this value would be set to zero.
csv_metadata_regex = ["^[#]?\s*(?P<key>[^:=]+)[:=]\s*(?P<value>\w+)$"]
csv_metadata_regex is a list of regex expressions, each regex must have a key and value label.
The regex expression above covers the following scenarios:
# comment line
# option 1: value1
option 2= value2
# another comment line
option3: value3
and returns the following metadata:
option 1=value1
option 2=value2
option3=value3
Note that the regex could also be used to ignore comments.
Example CSV file:
version=1.0
file created: 2021-10-08T12:34:18+10:00
timestamp,type,name,status
2020-11-23T08:19:27+10:00,Reader,R002,1
2020-11-04T13:23:04+10:00,Reader,R031,0
2020-11-04T13:29:47+10:00,Coordinator,C001,1
Current behaviour:
The current parser does not support metadata parsing. These rows need to be skipped.
Desired behaviour:
The output should include version and file created as either a tag or a field for every metric following the header.
Feature Request
Adding this option enables the parser to process metadata included before the CSV header.
This information can be included in every metric as a field or tag.
Proposal:
To add two new options to the CSV parser:
csv_metadata_rowsandcsv_metadata_regexcsv_metadata_rows = xwhere x is the number of rows that contain the metadata aftercsv_skip_rowsand before the header rows. By default, this value would be set to zero.csv_metadata_regex is a list of regex expressions, each regex must have a
keyandvaluelabel.The regex expression above covers the following scenarios:
and returns the following metadata:
option 1=value1option 2=value2option3=value3Note that the regex could also be used to ignore comments.
Example CSV file:
Current behaviour:
The current parser does not support metadata parsing. These rows need to be skipped.
Desired behaviour:
The output should include
versionandfile createdas either a tag or a field for every metric following the header.