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

Don't continuously log messages whenever no API token is configured #55

Closed
mamccorm opened this issue Apr 7, 2020 · 7 comments · Fixed by #63
Closed

Don't continuously log messages whenever no API token is configured #55

mamccorm opened this issue Apr 7, 2020 · 7 comments · Fixed by #63
Labels
kind/bug Bug related issue

Comments

@mamccorm
Copy link

mamccorm commented Apr 7, 2020

Describe the bug
Whenever no API token is configured for the datadog plugin, the plugin will continuously write to the jenkins system log, to this affect.

As a result, the jenkins system log is in affect useless as when debugging jenkins issues, the logs have likely already been rotated.

As an example, the plugin has written 17 log lines in 39 seconds:

Apr 07, 2020 8:04:56 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Started Datadog Counters Publisher
Apr 07, 2020 8:04:56 AM SEVERE org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient getInstance
Datadog API Key is not set properly
Apr 07, 2020 8:04:56 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Finished Datadog Counters Publisher. 5 ms
Apr 07, 2020 8:05:06 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Started Datadog Counters Publisher
Apr 07, 2020 8:05:06 AM SEVERE org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient getInstance
Datadog API Key is not set properly
Apr 07, 2020 8:05:06 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Finished Datadog Counters Publisher. 5 ms
Apr 07, 2020 8:05:16 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Started Datadog Counters Publisher
Apr 07, 2020 8:05:16 AM SEVERE org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient getInstance
Datadog API Key is not set properly
Apr 07, 2020 8:05:16 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Finished Datadog Counters Publisher. 5 ms
Apr 07, 2020 8:05:16 AM SEVERE org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient getInstance
Datadog API Key is not set properly
Apr 07, 2020 8:05:23 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Started EC2 Jenkins Agents Monitor
Apr 07, 2020 8:05:23 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Finished EC2 Jenkins Agents Monitor. 4 ms
Apr 07, 2020 8:05:26 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Started Datadog Counters Publisher
Apr 07, 2020 8:05:26 AM SEVERE org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient getInstance
Datadog API Key is not set properly
Apr 07, 2020 8:05:26 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Finished Datadog Counters Publisher. 5 ms
Apr 07, 2020 8:05:36 AM INFO hudson.model.AsyncPeriodicWork lambda$doRun$0
Started Datadog Counters Publisher
Apr 07, 2020 8:05:36 AM SEVERE org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient getInstance
Datadog API Key is not set properly

FYI, this is not the same issue reported here - while they are both related in the same area, the below was a regression which meant the logs were firing as exceptions:

To Reproduce
Steps to reproduce the behavior:

  1. Install latest datadog plugin (though this doesn't look to be a regression, it's been the behaviour for some time)
  2. Make sure an API token is not configured for the plugin (or the current one has expired)
  3. observe the Jenkins log

Expected behavior
The datadog plugin should not be spamming the jenkins log in such a way, that it makes it un-usable for debugging other issues which may occur.

Other plugins, such as the github plugin, do write to the log when an API token is not valid, e.g when it fails to create webhooks, but not in such high frequency.

Additional context
We operate an environment where we provide jenkins masters to other teams, maintaining a core set of plugins. Not all teams will leverage the plugins we have installed, such as the datadog plugin, and may not configure an API token for the plugin.

Others may have expired API tokens and as a result, if we need to debug any issues, the logs are not usable.

@mamccorm mamccorm added the kind/bug Bug related issue label Apr 7, 2020
@gzussa gzussa mentioned this issue Apr 7, 2020
6 tasks
@gzussa
Copy link
Contributor

gzussa commented Apr 7, 2020

Thanks for opening this issue. I am not sure i understand the use case here.

Are you using the DogStatsD or the Datadog Agent to report data to Datadog? If so it could to be a bug. However, it seems to me that you just installed the plugin and didn't configure it to sent any data. What is the purpose then?
If the token expires or is missing, the plugin should warn you, which it does.
Maybe severe log level is too strong, would it be fine if we change it to warning log level?

@mamccorm
Copy link
Author

mamccorm commented Apr 7, 2020

Hi @gzussa, looping in re: above:

However, it seems to me that you just installed the plugin and didn't configure it to sent any data. What is the purpose then?

That's correct - my concern was that when the plugin has not yet been configured, the logs are being spammed. The same would be true if the API token were to expire or become invalid. The issue isn't that it writes to the jenkins log, but that it does it so often, meaning that when it does occur, the log is essentially no use for triaging any other issues.

Regardless if the plugin is configured or not (or if the API token expired, as another example), it shouldn't be spamming the log so frequently, regardless of the log level. in the example above, it was writing 17 log lines in 40 seconds to the jenkins log

@gzussa
Copy link
Contributor

gzussa commented Apr 7, 2020

Ok i see your point, I notified the team in charge of the plugin and they will take a look. Feel free to open a support ticket if it needs to be escalated.

@github-actions
Copy link

github-actions bot commented May 9, 2020

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale Stale - Bot reminder label May 9, 2020
@sarah-witt sarah-witt removed the stale Stale - Bot reminder label May 9, 2020
@sarah-witt
Copy link
Collaborator

Unmarking as stale- we are currently working on this.

@jetersen
Copy link
Member

Actually the secondary fix to avoid running the task when no api token is valid too.

@jetersen
Copy link
Member

My PR #63 should fix a noise logger and avoid logging severe logs when no API key is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bug related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants