Source:
public ConfigParams build() { ConfigParams result = new ConfigParams(); String actualProjectName = determineProjectName.apply(projectName); result.projectName = validateString(actualProjectName, "stackdriver projectName"); result.applicationName = validateString(applicationName, "applicationName"); result.customTypeNamespace = validateString(customTypeNamespace, "stackdriver customTypeNamespace"); result.uniqueMetricsPerApplication = uniqueMetricsPerApplication; result.counterStartTime = counterStartTime; result.measurementFilter = measurementFilter; result.instanceId = instanceId; result.monitoring = monitoring; result.descriptorCache = descriptorCache; if (result.instanceId == null || result.instanceId.isEmpty()) { UUID uuid = UUID.randomUUID(); byte[] uuidBytes = new byte[16]; addLong(uuidBytes, 0, uuid.getLeastSignificantBits()); addLong(uuidBytes, 8, uuid.getMostSignificantBits()); result.instanceId = java.util.Base64.getEncoder().encodeToString(uuidBytes); } if (result.monitoring == null) { try { HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); GoogleCredential credential = loadCredential(transport, jsonFactory, credentialsPath); String version = getClass().getPackage().getImplementationVersion(); result.monitoring = new Monitoring.Builder(transport, jsonFactory, credential) .setApplicationName("Spinnaker/" + version) .build(); } catch (IOException | java.security.GeneralSecurityException e) { final Logger log = LoggerFactory.getLogger("StackdriverWriter"); log.error("Caught exception initializing client: " + e); throw new IllegalStateException(e); } } if (result.descriptorCache == null) { result.descriptorCache = new MetricDescriptorCache(result); } return result; }

Target:
public ConfigParams build() { ConfigParams result = new ConfigParams(); String actualProjectName = determineProjectName.apply(projectName); result.projectName = validateString(actualProjectName, "stackdriver projectName"); result.applicationName = validateString(applicationName, "applicationName"); result.customTypeNamespace = validateString(customTypeNamespace, "stackdriver customTypeNamespace"); result.uniqueMetricsPerApplication = uniqueMetricsPerApplication; result.counterStartTime = counterStartTime; result.measurementFilter = measurementFilter; result.instanceId = instanceId; result.monitoring = monitoring; result.descriptorCache = descriptorCache; if (result.instanceId == null || result.instanceId.isEmpty()) { UUID uuid = UUID.randomUUID(); byte[] uuidBytes = new byte[16]; addLong(uuidBytes, 0, uuid.getLeastSignificantBits()); addLong(uuidBytes, 8, uuid.getMostSignificantBits()); result.instanceId = java.util.Base64.getEncoder().encodeToString(uuidBytes); } if (result.monitoring == null) { try { HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); GoogleCredential credential = loadCredential(transport, jsonFactory, credentialsPath); String version = getClass().getPackage().getImplementationVersion(); if (version == null) { version = "Unknown"; } result.monitoring = new Monitoring.Builder(transport, jsonFactory, credential) .setApplicationName("Spinnaker/" + version) .build(); } catch (IOException | java.security.GeneralSecurityException e) { final Logger log = LoggerFactory.getLogger("StackdriverWriter"); log.error("Caught exception initializing client: " + e); throw new IllegalStateException(e); } } if (result.descriptorCache == null) { result.descriptorCache = new MetricDescriptorCache(result); } return result; }