diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollector.java b/src/main/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollector.java index d3299c879..aec8d657b 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollector.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollector.java @@ -16,7 +16,7 @@ public class JenkinsStatusCollector extends Collector { public List collect() { CollectorFactory factory = new CollectorFactory(); - + Jenkins jenkins = Jenkins.get(); List> collectors = new ArrayList<>(); collectors.add(factory.createJenkinsCollector(CollectorType.JENKINS_VERSION_INFO_GAUGE, new String[]{})); @@ -24,7 +24,7 @@ public List collect() { collectors.add(factory.createJenkinsCollector(CollectorType.JENKINS_UPTIME_GAUGE, new String[]{})); collectors.add(factory.createJenkinsCollector(CollectorType.NODES_ONLINE_GAUGE, new String[]{"node"})); - collectors.forEach(c -> c.calculateMetric(Jenkins.get(), new String[]{})); + collectors.forEach(c -> c.calculateMetric(jenkins, new String[]{})); return collectors.stream() .map(MetricCollector::collect)