Skip to content

Commit

Permalink
refactoring duplicated code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehong-kim committed Oct 2, 2015
1 parent 6f2379b commit 0c56704
Showing 1 changed file with 4 additions and 9 deletions.
Expand Up @@ -148,13 +148,9 @@ public void before(Object target, Object[] args) {
httpRequest.setHeader(Header.HTTP_PARENT_APPLICATION_TYPE.toString(), Short.toString(traceContext.getServerTypeCode()));
final NameIntValuePair<String> host = getHost();
if (host != null) {
final StringBuilder hostStringBuilder = new StringBuilder(host.getName());
if (host.getValue() > 0) {
hostStringBuilder.append(":").append(host.getValue());
}
final String hostString = hostStringBuilder.toString();
logger.debug("Get host {}", hostString);
httpRequest.setHeader(Header.HTTP_HOST.toString(), hostString);
final String endpoint = getEndpoint(host.getName(), host.getValue());
logger.debug("Get host {}", endpoint);
httpRequest.setHeader(Header.HTTP_HOST.toString(), endpoint);
}
}

Expand Down Expand Up @@ -207,8 +203,7 @@ public void after(Object target, Object result, Throwable throwable, Object[] ar
recorder.recordAttribute(AnnotationKey.HTTP_URL, httpRequest.getRequestLine().getUri());
final NameIntValuePair<String> host = getHost();
if (host != null) {
int port = host.getValue();
String endpoint = getEndpoint(host.getName(), port);
final String endpoint = getEndpoint(host.getName(), host.getValue());
recorder.recordDestinationId(endpoint);
}

Expand Down

0 comments on commit 0c56704

Please sign in to comment.