Skip to content
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 errors not being logged for plugin.Gather #133

Closed

Conversation

nickscript0
Copy link
Contributor

Currently if plugin.Gather returns an error it does not show up in the telegraf log. This PR adds logging to show an error in both crankParallel and crankSeparate cases.

For example a misconfigured plugin as follows currently show no errors:

[mysql]
servers = ["notlocalhost"]

After this fix it shows an error as expected:

./telegraf -config /etc/opt/telegraf/telegraf.conf
2015/08/22 20:48:07 Starting Telegraf
2015/08/22 20:48:07 Loaded outputs: influxdb
2015/08/22 20:48:07 Loaded plugins: cpu mysql
2015/08/22 20:48:07 Tags enabled: dc=test1 host=a11790
2015/08/22 20:48:07 Error in plugins: Invalid DSN: Missing the slash separating the database name

plugin.plugin.Gather(&acc)
err := plugin.plugin.Gather(&acc)
if err != nil {
log.Printf("Error in plugins: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add plugin.name to the debug message, something like

log.Printf("Error in plugin [%s]: %s", plugin.name, err)

@sparrc
Copy link
Contributor

sparrc commented Aug 24, 2015

Thanks @nickscript0! Please add your change to the CHANGELOG under features

You'll also need to sign the CLA, I'll send details shortly

@sparrc
Copy link
Contributor

sparrc commented Aug 24, 2015

Oops, nevermind, I see that you've already signed it, thanks!

I'll merge when you add the comments I made, thanks much!

@nickscript0
Copy link
Contributor Author

Addressed your comments: added plugin name and updated CHANGELOG. Should be good to merge now.

@sparrc
Copy link
Contributor

sparrc commented Aug 24, 2015

Thanks @nickscript0! These changes have been rebased into master

@sparrc sparrc closed this Aug 24, 2015
@nickscript0 nickscript0 deleted the add_plugin_error_log branch August 24, 2015 23:23
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.

2 participants