-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: reallow specifying the influx parser type #11806
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.
Thanks for the fix @powersj. I think we should add influx_parser_type
back to missingTomlField()
instead of adding this intermediate option to the struct. For 2.0 we should consider deprecating this additional flag, move the upstream parser below plugins/parsers
and require users to set data_format = "influx_upstream"
.
config/config.go
Outdated
var influxParserType string | ||
c.getFieldString(table, "influx_parser_type", &influxParserType) | ||
if influxParserType == "upstream" { | ||
dataformat = "influx_upstream" | ||
} |
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.
How about dealing with this here completely like
var influxParserType string | |
c.getFieldString(table, "influx_parser_type", &influxParserType) | |
if influxParserType == "upstream" { | |
dataformat = "influx_upstream" | |
} | |
var influxParserType string | |
c.getFieldString(table, "influx_parser_type", &influxParserType) | |
if dataformat == "influx" && influxParserType == "upstream" { | |
dataformat = "influx_upstream" | |
} |
This should automatically solve the issue without the need to pass the parser type down the line...
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.
ok! changes pushed!
@@ -104,7 +104,8 @@ func convertToParseError(input []byte, rawErr error) error { | |||
type Parser struct { | |||
DefaultTags map[string]string `toml:"-"` | |||
// If set to "series" a series machine will be initialized, defaults to regular machine | |||
Type string `toml:"-"` | |||
Type string `toml:"-"` | |||
ParserType string `toml:"influx_parser_type"` |
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.
I think this is not needed, instead add back "influx_parser_type"
back to missingTomlField()
here...
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.
reverted
plugins/parsers/influx/parser.go
Outdated
@@ -62,7 +62,8 @@ func (e *ParseError) Error() string { | |||
type Parser struct { | |||
DefaultTags map[string]string `toml:"-"` | |||
// If set to "series" a series machine will be initialized, defaults to regular machine | |||
Type string `toml:"-"` | |||
Type string `toml:"-"` | |||
ParserType string `toml:"influx_parser_type"` |
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.
See above.
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.
reverted
There was logic in the parser registry that was lost in recent parser consolidation that allowed a user to specify which parser they wanted. In the case of exec, execd, and other plugins that use the older parsers.ParserInput, this logic was no longer applied. fixes: influxdata#11801
For 2.0, we want to set the default parser to be the upstream, and deprecate the additional option. Then for a 3.0, remove the option and only use "upstream" |
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
(cherry picked from commit d091a59)
There was logic in the parser registry that was lost in recent parser consolidation that allowed a user to specify which parser they wanted. In the case of exec, execd, and other plugins that use the older parsers.ParserInput, this logic was no longer applied.
Additionally, there were errors about the influx_parser_type config option not getting used.
fixes: #11801