-
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
fix: Update prometheus parser to be a new style parser plugin #11440
Conversation
There are a couple prometheus settings that don't seem to do anything. I'm not sure if they are mistakes or if they were valid settings in the past and were removed, then intentionally left in so they will be ignored for backward compatibility.
I removed these in this PR but I'm having second thoughts. I need to figure out what to do with these before we merge this PR. |
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. Just one comment regarding Init
.
I think your option-removal is safe, but I would prefer to do the serializer one in an extra PR to be able to easily revert it if necessary.
plugins/parsers/prometheus/parser.go
Outdated
func (p *Parser) Init() error { | ||
return nil | ||
} | ||
|
||
func (p *Parser) InitFromConfig(config *parsers.Config) error { | ||
p.IgnoreTimestamp = config.PrometheusIgnoreTimestamp | ||
return p.Init() | ||
} |
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.
You can kill Init
here and just return nil
func (p *Parser) Init() error { | |
return nil | |
} | |
func (p *Parser) InitFromConfig(config *parsers.Config) error { | |
p.IgnoreTimestamp = config.PrometheusIgnoreTimestamp | |
return p.Init() | |
} | |
func (p *Parser) InitFromConfig(config *parsers.Config) error { | |
p.IgnoreTimestamp = config.PrometheusIgnoreTimestamp | |
return nil | |
} |
I updated this to touch only the prometheus parser and to remove the empty Init() |
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 👍 This pull request doesn't change the Telegraf binary size 📦 Click here to get additional PR build artifactsArtifact 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 migrating this one @reimda!
resolves #11361