-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Regression: CSV parser does not handle csv_skip_rows correctly #10347
Comments
I think problem is #9865: commit (db86904#diff-2c668efeba00e299cb699055ee85b8a114f60aae8d7684c4f4f70ac2bc1b70f4) changes skiprow loop from:
to
So on second input As a workaround you could try splitting
|
Thanks for reaching out and digging in the changeset. Yeah, seems like there is some hassle with the counter, which should not be decreased - at least not the original config value. Something like?!:
Unfortunately, I'm not proficient enough in the go language nor in the project architecture to provide a patch. Related to your workaround: The debug run looks good, ...
...but the log still complains about invalid values:
Are the outputs collected in some sort of cache and batch processed during the flush? |
I have a simular issue with skip-headers in [[inputs.exec]] running a powershell script that spits out a two column csv with headers. The first loop is fine and writes to DB. In the next telegraf agent loop/execution the csv header is not skipped, and so the write to the database fails the data type check and no further data is recored. I have tried all combinations of csv_header_row_count and csv_skip_rows and it doesn't seam to make any changes. I have encluded the below that should be all you need to recreate the issue? I have version Telegraf 1.21.1 (git: HEAD 7c9a9c1) telegraf.conf
get-memory-details-csv-bytes.ps1
ERROR msg: where 'WorkingSet' is the CSV column header from the powershell CSV CSV example:
|
I don't know, but I'm guessing that the parser is initialized once on startup and after first use the counters become 0 and after that cvs header is not skipped. If I read the comments on #9865 correctly skipping csv header only once is ok/desired for example with (I think as a workaround you can use starlark to drop the incorrect csv header metric:
) |
Hi @jjh74, I think the issue is that the inputs.exec is not creating a new parser object for each execution. |
Hi @DennisBayer @byte-opps @jjh74 @etycomputer - Would you be willing to test the artifacts on this parser restructuring PR here: #8791 (comment). This PR should address Update: artificats rebuilt as of Jan-12-2022 |
Closed by #8791 |
Relevent telegraf.conf
Logs from Telegraf
Note: I added new lines in the test run between each mtr output for easier reading.
1.20.4
1.21.1
System info
Telegraf 1.21.1; Docker Compose version 2.2.2; Docker version 20.10.11, build dea9396e18; Manjaro
Docker
./telegraf/Dockerfile-mtr
./docker-compose.yml
Steps to reproduce
Expected behavior
Actual behavior
Failed to write metric (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field "best" on measurement "mtr" is type string, already exists as type float dropped=3
is loggedmtr,dest=Host,hop=Hop,host=mimas,ip=Ip avg="Avg",best="Best",loss="Loss%",snt="Snt",status="Status",stdev="StDev",worst="Wrst" 1640364294000000000
for the latter one.Additional info
Since I did not find any release notes about a changed behavior, I assume that this is a regression.
Reading the release notes pointed me to a fix #9865 which is related to
csv_skip_rows
andcsv_header_row_count
.@etycomputer: Might this behavior be related to your fix in any way or am I on the wrong track?
Any combination of
csv_skip_rows = 0|1
andcsv_header_row_count = 0|1
did not result in any success.The text was updated successfully, but these errors were encountered: