-
Notifications
You must be signed in to change notification settings - Fork 152
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
Add new metric for Quiet Mode status #687
Conversation
This metric exposes the Jenkins isQuietingDown status as a gauge. When Jenkins is in quiet mode, the new metric will represent this as a '1', otherwise the value will be '0' Exposing this metric allows Prometheus to determine whether Jenkins is in quiet mode. This can be useful in cases where an alert should be triggered if quiet mode has been enabled for too long or falls outside of a maintenance window. Fixes issue jenkinsci#686
@@ -40,6 +40,7 @@ | |||
| default_jenkins_up | Shows if jenkins ready to receive requests | gauge | | |||
| default_jenkins_uptime | Shows time since Jenkins was initialized | gauge | | |||
| default_jenkins_nodes_online | Shows Nodes online status | gauge | | |||
| default_jenkins_quietdown | Shows if jenkins is in quiet mode | gauge | |
Check warning
Code scanning / Markdownlint (reported by Codacy)
Expected: 80; Actual: 95 Warning documentation
|
||
|
||
@Test | ||
public void testCollectResultForJenkinsQuietModeEnabled() { |
Check notice
Code scanning / Pmd (reported by Codacy)
JUnit tests should include assert() or fail() Note test
} | ||
|
||
@Test | ||
public void testJenkinsIsNull() { |
Check notice
Code scanning / Pmd (reported by Codacy)
JUnit tests should include assert() or fail() Note test
|
||
|
||
@Test | ||
public void testCollectResultForJenkinsQuietModeDisabled() { |
Check notice
Code scanning / Pmd (reported by Codacy)
JUnit tests should include assert() or fail() Note test
@sstafford - Thanks for the PR. The code looks good. Could you fix the test |
The unit test checks the number of status metrics. Adding a new metric caused this test to fail. The number of metrics needed to be incremented to fix the test.
This pull request introduces a new "default_jenkins_quietdown" metric to indicate whether Jenkins is in quiet mode. It can be used to monitor whether Jenkins is processing new jobs. It uses the Jenkins.isQuietingDown method to determine the status of the server:
This is a fix for Issue #686