-
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
feat: Parser plugin restructuring #8791
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤝 ✅ CLA has been signed. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall I think it's headed in the right direction. some thoughts:
- I don't think you can remove parsers.Parsers without breaking backwards compatibility, it's part of the contract we maintain to plugins.
- I don't feel like giving parsers their own runners makes sense in the way it does for inputs/etc, because they really belong to the plugin using them.
- FYI there's future parser work related to stream parsers, and supporting multiple parsers per input plugin at some point.
08b4dce
to
7252f1a
Compare
@sspaink, @reimda, @powersj, @MyaLongmire here is the discussed update. Would love to get your feedback! |
12b9a40
to
0c02235
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I think this looks good.
…ward-compatibility.
…. perform AND operations for input/parser misses.
… the old way otherwise.
… with external plugins.
0c02235
to
8109072
Compare
📦 Looks like new artifacts were built from this PR. Expand this list to get them here ! 🐯Artifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for working on this. It will be nice to switch them all over to the new system and then remove the old compatibility code!
@etycomputer could you please submit a PR adding this as a test-case? Your help would be very much appreciated! |
Required for all PRs:
This PR restructures the parser plugin infrastructure to match those of other plugins (e.g. input, aggregators,...) with a central registry and config definitions (including TOML tags) in the parser code itself. This reliefs new parsers for spraying the code all over the project and allow them to keep all in one place (the parser code).
By using the new infrastructure you get some goodies for free like support of logging via definition of
Log telegraf.Logger 'toml:"-"'
and internal plugin statisticsmetrics_parsed
andparse_time_ns
. We keep backward compatibility so parsers not ported yet are still supported.This PR currently only converts the CSV parser to the new interface as a PoC and fixes the fallout.
The main benefit is that now, implementing new parser plugins has the same procedure as all other plugins. You write your self-contained parser in a sub-directory below
plugins/parsers
, add it toplugins/parsers/all/all.go
and update the documentation. No need anymore to add TOML exceptions inconfig
or fight withplugins/parsers/registration.go
.