forked from lsjostro/prometheus-plugin
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding configuration option to exclude jobs from Prometheus metrics v…
…ia Regex (#699) * Adding configuration option to exclude jobs from Prometheus metrics * Removing unused parameter --------- Co-authored-by: Waschndolos <[email protected]>
- Loading branch information
1 parent
7425fa1
commit 52e8f47
Showing
6 changed files
with
97 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../java/org/jenkinsci/plugins/prometheus/config/disabledmetrics/JobRegexDisabledMetric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.jenkinsci.plugins.prometheus.config.disabledmetrics; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import hudson.Extension; | ||
import hudson.model.Descriptor; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
public class JobRegexDisabledMetric extends Entry { | ||
|
||
private final String regex; | ||
|
||
@DataBoundConstructor | ||
public JobRegexDisabledMetric(String regex) { | ||
this.regex = regex; | ||
} | ||
|
||
public String getRegex() { | ||
return regex; | ||
} | ||
|
||
@Override | ||
public Descriptor<Entry> getDescriptor() { | ||
return new DescriptorImpl(); | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends Descriptor<Entry> { | ||
@Override | ||
@NonNull | ||
public String getDisplayName() { | ||
return "Job Regex Entry"; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...g/jenkinsci/plugins/prometheus/config/disabledmetrics/JobRegexDisabledMetric/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> | ||
<f:entry field="regex" title="Regex matching metric for Jobs" description="Enter a regex matching job full names you want to exclude from calculation"> | ||
<f:textbox/> | ||
</f:entry> | ||
</j:jelly> |