Source:
<code>public Response postRequest(GatewayAccountEntity account, OrderRequestType requestType, URI url, String jsonPayload, String authHeaderValue) { String metricsPrefix = format("gateway-operations.%s.%s.%s", account.getGatewayName(), account.getType(), requestType); <START> Response response; <END> Stopwatch responseTimeStopwatch = Stopwatch.createStarted(); try { logger.info("POSTing request for account '{}' with type '{}'", account.getGatewayName(), account.getType()); response = client.target(url.toString()) .request() .header(AUTHORIZATION, authHeaderValue) .post(Entity.entity(jsonPayload, APPLICATION_JSON_TYPE)); if (response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) { logger.error("Stripe gateway returned server error: {}, for gateway url={} with type {}", response.getStatus(), url.toString(), account.getType()); incrementFailureCounter(metricRegistry, metricsPrefix); throw new WebApplicationException("Unexpected HTTP status code " + response.getStatus() + " from gateway"); } return response; } catch (ProcessingException pe) { incrementFailureCounter(metricRegistry, metricsPrefix); if (pe.getCause() != null) { if (pe.getCause() instanceof UnknownHostException) { logger.error(format("DNS resolution error for gateway url=%s", url.toString()), pe); throw new WebApplicationException("Gateway Url DNS resolution error"); } if (pe.getCause() instanceof SocketTimeoutException) { logger.error(format("Connection timed out error for gateway url=%s", url.toString()), pe); throw new WebApplicationException("Gateway connection timeout error"); } if (pe.getCause() instanceof SocketException) { logger.error(format("Socket Exception for gateway url=%s", url.toString()), pe); throw new WebApplicationException("Gateway connection socket error"); } } logger.error(format("Exception for gateway url=%s", url.toString()), pe); throw new WebApplicationException(pe.getMessage()); } finally { responseTimeStopwatch.stop(); metricRegistry.histogram(metricsPrefix + ".response_time").update(responseTimeStopwatch.elapsed(TimeUnit.MILLISECONDS)); } }</code><technical_language>A trivial thing, do this in line 48</technical_language>

Target:
public Response postRequest(GatewayAccountEntity account, OrderRequestType requestType, URI url, String jsonPayload, String authHeaderValue) { String metricsPrefix = format("gateway-operations.%s.%s.%s", account.getGatewayName(), account.getType(), requestType); Stopwatch responseTimeStopwatch = Stopwatch.createStarted(); try { logger.info("POSTing request for account '{}' with type '{}'", account.getGatewayName(), account.getType()); Response response = client.target(url.toString()) .request() .header(AUTHORIZATION, authHeaderValue) .post(Entity.entity(jsonPayload, APPLICATION_JSON_TYPE)); if (response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) { logger.error("Stripe gateway returned server error: {}, for gateway url={} with type {}", response.getStatus(), url.toString(), account.getType()); incrementFailureCounter(metricRegistry, metricsPrefix); throw new WebApplicationException("Unexpected HTTP status code " + response.getStatus() + " from gateway"); } return response; } catch (ProcessingException pe) { incrementFailureCounter(metricRegistry, metricsPrefix); if (pe.getCause() != null) { if (pe.getCause() instanceof UnknownHostException) { logger.error(format("DNS resolution error for gateway url=%s", url.toString()), pe); throw new WebApplicationException("Gateway Url DNS resolution error"); } if (pe.getCause() instanceof SocketTimeoutException) { logger.error(format("Connection timed out error for gateway url=%s", url.toString()), pe); throw new WebApplicationException("Gateway connection timeout error"); } if (pe.getCause() instanceof SocketException) { logger.error(format("Socket Exception for gateway url=%s", url.toString()), pe); throw new WebApplicationException("Gateway connection socket error"); } } logger.error(format("Exception for gateway url=%s", url.toString()), pe); throw new WebApplicationException(pe.getMessage()); } finally { responseTimeStopwatch.stop(); metricRegistry.histogram(metricsPrefix + ".response_time").update(responseTimeStopwatch.elapsed(TimeUnit.MILLISECONDS)); } }