Source:
public void doRun() throws Exception { try { logger.fine("doRun called: Computing Node metrics"); DatadogClient client = getDatadogClient(); String hostname = DatadogUtilities.getHostname(null); if(client == null){ return; } long nodeCount = 0; long nodeOffline = 0; long nodeOnline = 0; Jenkins jenkins = Jenkins.getInstance(); Computer[] computers = new Computer[0]; if(jenkins != null){ computers = jenkins.getComputers(); } Map<String, Set<String>> globalTags = DatadogUtilities.getTagsFromGlobalTags(); globalTags = TagsUtil.addTagToTags(globalTags, "jenkins_url", DatadogUtilities.getJenkinsUrl()); for (Computer computer : computers) { Map<String, Set<String>> tags = TagsUtil.merge( DatadogUtilities.getComputerTags(computer), globalTags); nodeCount++; int isOnline = 1; int isOffline = 0; if (computer.isOffline()) { isOnline = 0; isOffline = 1; nodeOffline++; } if (computer.isOnline()) { nodeOnline++; } int executorCount = computer.countExecutors(); int inUse = computer.countBusy(); int free = computer.countIdle(); client.gauge("jenkins.node_status.online", isOnline, hostname, tags); client.gauge("jenkins.node_status.offline", isOffline, hostname, tags); client.gauge("jenkins.node_status.count", 1, hostname, tags); client.gauge("jenkins.executor.count", executorCount, hostname, tags); client.gauge("jenkins.executor.in_use", inUse, hostname, tags); client.gauge("jenkins.executor.free", free, hostname, tags); } client.gauge("jenkins.node.count", nodeCount, hostname, globalTags); client.gauge("jenkins.node.offline", nodeOffline, hostname, globalTags); client.gauge("jenkins.node.online", nodeOnline, hostname, globalTags); } catch (Exception e) { DatadogUtilities.severe(logger, e, null); } }

Target:
protected void doRun() throws Exception { try { logger.fine("doRun called: Computing Node metrics"); DatadogClient client = ClientFactory.getClient(); String hostname = DatadogUtilities.getHostname(null); if(client == null){ return; } long nodeCount = 0; long nodeOffline = 0; long nodeOnline = 0; Jenkins jenkins = Jenkins.getInstance(); Computer[] computers = new Computer[0]; if(jenkins != null){ computers = jenkins.getComputers(); } Map<String, Set<String>> globalTags = DatadogUtilities.getTagsFromGlobalTags(); globalTags = TagsUtil.addTagToTags(globalTags, "jenkins_url", DatadogUtilities.getJenkinsUrl()); for (Computer computer : computers) { Map<String, Set<String>> tags = TagsUtil.merge( DatadogUtilities.getComputerTags(computer), globalTags); nodeCount++; if (computer.isOffline()) { nodeOffline++; client.gauge("jenkins.node_status.up", 0, hostname, tags); } if (computer.isOnline()) { nodeOnline++; client.gauge("jenkins.node_status.up", 1, hostname, tags); } int executorCount = computer.countExecutors(); int inUse = computer.countBusy(); int free = computer.countIdle(); client.gauge("jenkins.node_status.count", 1, hostname, tags); client.gauge("jenkins.executor.count", executorCount, hostname, tags); client.gauge("jenkins.executor.in_use", inUse, hostname, tags); client.gauge("jenkins.executor.free", free, hostname, tags); } client.gauge("jenkins.node.count", nodeCount, hostname, globalTags); client.gauge("jenkins.node.offline", nodeOffline, hostname, globalTags); client.gauge("jenkins.node.online", nodeOnline, hostname, globalTags); } catch (Exception e) { DatadogUtilities.severe(logger, e, null); } }