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:
- Install latest datadog plugin (though this doesn't look to be a regression, it's been the behaviour for some time)
- Make sure an API token is not configured for the plugin (or the current one has expired)
- 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.