Avoid unnecessary objects creation in Apache Http Client instrumnentation
This commit is contained in:
parent
5f455ead3c
commit
0748c10b72
|
@ -2,9 +2,7 @@ package datadog.trace.instrumentation.apachehttpclient;
|
||||||
|
|
||||||
import datadog.trace.agent.decorator.HttpClientDecorator;
|
import datadog.trace.agent.decorator.HttpClientDecorator;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.RequestLine;
|
|
||||||
import org.apache.http.client.methods.HttpUriRequest;
|
import org.apache.http.client.methods.HttpUriRequest;
|
||||||
|
|
||||||
public class ApacheHttpClientDecorator extends HttpClientDecorator<HttpUriRequest, HttpResponse> {
|
public class ApacheHttpClientDecorator extends HttpClientDecorator<HttpUriRequest, HttpResponse> {
|
||||||
|
@ -22,13 +20,12 @@ public class ApacheHttpClientDecorator extends HttpClientDecorator<HttpUriReques
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String method(final HttpUriRequest httpRequest) {
|
protected String method(final HttpUriRequest httpRequest) {
|
||||||
return httpRequest.getRequestLine().getMethod();
|
return httpRequest.getMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected URI url(final HttpUriRequest request) throws URISyntaxException {
|
protected URI url(final HttpUriRequest request) {
|
||||||
final RequestLine requestLine = request.getRequestLine();
|
return request.getURI();
|
||||||
return requestLine == null ? null : new URI(requestLine.getUri());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue