Source:
<code>public final void onStarted(final Run run, final TaskListener listener) { String jobName = run.getParent().getFullName(); Map<String,String> tags = new HashMap<String,String>(); if ( DatadogUtilities.isJobTracked(jobName) ) { logger.fine("Started build!"); <START> Boolean useJobRegex = DatadogUtilities.getDatadogDescriptor().getJobRegex(); <END> if (useJobRegex) { tags.putAll(DatadogUtilities.getRegexJobTags(jobName)); } Queue.Item item = queue.getItem(run.getQueueId()); JSONObject builddata = new JSONObject(); Map<String,String> extraTags = DatadogUtilities.buildExtraTags(run, listener); extraTags.putAll(tags); builddata.put("job", DatadogUtilities.normalizeFullDisplayName(jobName)); builddata.put("number", run.number); builddata.put("result", null); builddata.put("duration", null); builddata.put("waiting", (System.currentTimeMillis() - item.getInQueueSince()) / DatadogBuildListener.THOUSAND_LONG); long starttime = run.getStartTimeInMillis() / DatadogBuildListener.THOUSAND_LONG; builddata.put("timestamp", starttime); try { EnvVars envVars = run.getEnvironment(listener); tags.putAll(DatadogUtilities.parseTagList(run, listener)); builddata.put("hostname", DatadogUtilities.getHostname(envVars)); builddata.put("buildurl", envVars.get("BUILD_URL")); } catch (IOException e) { logger.severe(e.getMessage()); } catch (InterruptedException e) { logger.severe(e.getMessage()); } BuildStartedEventImpl evt = new BuildStartedEventImpl(builddata, tags); DatadogHttpRequests.sendEvent(evt); gauge("jenkins.job.waiting", builddata, "waiting", extraTags); } }</code><technical_language>Change Boolean primitive. This avoid creating a new object. Also, do check for null here</technical_language>

Target:
public final void onStarted(final Run run, final TaskListener listener) { String jobName = run.getParent().getFullName(); logger.fine(String.format("onStarted() called with jobName: %s", jobName)); Map<String,String> tags = new HashMap<String,String>(); if ( DatadogUtilities.isJobTracked(jobName) ) { logger.fine("Started build!"); tags.putAll(DatadogUtilities.getRegexJobTags(jobName)); Queue.Item item = queue.getItem(run.getQueueId()); JSONObject builddata = new JSONObject(); Map<String,String> extraTags = DatadogUtilities.buildExtraTags(run, listener); extraTags.putAll(tags); builddata.put("job", DatadogUtilities.normalizeFullDisplayName(jobName)); builddata.put("number", run.number); builddata.put("result", null); builddata.put("duration", null); builddata.put("waiting", (System.currentTimeMillis() - item.getInQueueSince()) / DatadogBuildListener.THOUSAND_LONG); long starttime = run.getStartTimeInMillis() / DatadogBuildListener.THOUSAND_LONG; builddata.put("timestamp", starttime); try { EnvVars envVars = run.getEnvironment(listener); tags.putAll(DatadogUtilities.parseTagList(run, listener)); builddata.put("hostname", DatadogUtilities.getHostname(envVars)); builddata.put("buildurl", envVars.get("BUILD_URL")); } catch (IOException e) { logger.severe(e.getMessage()); } catch (InterruptedException e) { logger.severe(e.getMessage()); } BuildStartedEventImpl evt = new BuildStartedEventImpl(builddata, tags); DatadogHttpRequests.sendEvent(evt); gauge("jenkins.job.waiting", builddata, "waiting", extraTags); logger.fine("Finished onStarted()"); } }