8000 Add a FieldSeaparator option to tail_csv plugin by redbaron4 · Pull Request #3394 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add a FieldSeaparator option to tail_csv plugin #3394

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

Merged
merged 1 commit into from
Mar 3, 2020
Merged

Add a FieldSeaparator option to tail_csv plugin #3394

merged 1 commit into from
Mar 3, 2020

Conversation

redbaron4
Copy link
Contributor
@redbaron4 redbaron4 commented Mar 3, 2020

This PR adds a new option to tail_csv plugin called FieldSeparator. The value for this option is a single character. This option is used to define a custom separator. Default will be ',' so the PR is backward compatble.

Closes #2893

ChangeLog: tail_csv plugin: Adds a FieldSeparator option

Copy link
Contributor
@dago dago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dago dago merged commit be05f1b into collectd:master Mar 3, 2020
Copy link
Contributor
@rpv-tomsk rpv-tomsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rules are created to break them?

Nobody wants to do code reviews.
It is much easier to press "merge" than do careful review.

@dago, will you fix these issues?

WARNING("tail_csv plugin: The \"%s\" config option needs exactly one "
"string argument.",
ci->key);
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You return -1 here, so reporting should be ERROR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other invalid configuration options are also reported as WARNING and should then for consistency also be changed to ERROR, however, I see some more occurrences of WARNING in other plugins for ignored options, so this looks overall consistent me unless I am missing something.

Copy link
Contributor
@rpv-tomsk rpv-tomsk Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't look into plugins code, maintainers often do merge without deep analysis.
Look into src/daemon/configfile.c that maintained by @collectd/core-maintainers which are more qualified.
The policy is simple - if function returns error, then message should be ERROR too, otherwise WARNING.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see in the code ERROR is always followed by return -1, but there are occurrences in the code where return -1 is preceded by WARNING, so I would say causality goes only in one direction here, e.g.

WARNING("Found a configuration for the `%s' plugin, but "
"the plugin didn't register a configuration callback.",
plugin_name);
return -1;

However, from looking at the actual usages in the tail_csv.c plugin these should very well be errors and warnings should probably only allowed for backwards compatibility which is not the case here.

return -1;
}

len_opt = strlen(ci->values[0].value.string);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Policy ask us to declare variables at first use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this @rpv-tomsk , the variable has been declared at L282 unless I am missing something here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@redbaron4
Copy link
Contributor Author

@rpv-tomsk Ah OK I see it now. Do you want me to open another pull request to fix these issues. I can mark it as a WIP so that merging is hopefully not done until it has been satisfactorily reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugin tail_csv should allow user specified separator
3 participants
0