Stub google http client integration
ADD
dd-java-agent/instrumentation/google-http-client/google-http-client.gradle
+muzzle {
+ pass {
+ group = "com.google.http-client"
+ module = "google-http-client"
+ versions = "[1.2.0,)"
+ }
+}
+
+apply from: "${rootDir}/gradle/java.gradle"
+apply plugin: 'org.unbroken-dome.test-sets'
+
+testSets {
+ latestDepTest {
+ dirName = 'test'
+ }
+}
+
+dependencies {
+ compileOnly group: 'com.google.http-client', name: 'google-http-client', version: '1.20.0'
+
+ compile project(':dd-java-agent:agent-tooling')
+
+ compile deps.bytebuddy
+ compile deps.opentracing
+ annotationProcessor deps.autoservice
+ implementation deps.autoservice
+
+ testCompile project(':dd-java-agent:testing')
+ testCompile group: 'com.google.http-client', name: 'google-http-client', version: '1.20.0'
+
+ latestDepTestCompile group: 'com.google.http-client', name: 'google-http-client', version: '+'
+}

ADD
dd-java-agent/instrumentation/google-http-client/src/main/java/datadog/trace/instrumentation/apachehttpclient/GoogleHttpClientDecorator.java
+package datadog.trace.instrumentation.apachehttpclient;
+
+import com.google.api.client.http.HttpRequest;
+import com.google.api.client.http.HttpResponse;
+import datadog.trace.agent.decorator.HttpClientDecorator;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+public class GoogleHttpClientDecorator extends HttpClientDecorator<HttpRequest, HttpResponse> {
+ public static final GoogleHttpClientDecorator DECORATE = new GoogleHttpClientDecorator();
+
+ @Override
+ protected String method(final HttpRequest httpRequest) {
+ return httpRequest.getRequestMethod();
+ }
+
+ @Override
+ protected URI url(final HttpRequest httpRequest) throws URISyntaxException {
+ return httpRequest.getUrl().toURI();
+ }
+
+ @Override
+ protected String hostname(final HttpRequest httpRequest) {
+ return httpRequest.getUrl().getHost();
+ }
+
+ @Override
+ protected Integer port(final HttpRequest httpRequest) {
+ return httpRequest.getUrl().getPort();
+ }
+
+ @Override
+ protected Integer status(final HttpResponse httpResponse) {
+ return httpResponse.getStatusCode();
+ }
+
+ @Override
+ protected String[] instrumentationNames() {
+ return new String[] {"google-http-client"};
+ }
+
+ @Override
+ protected String component() {
+ return "google-http-client";
+ }
+}

ADD
dd-java-agent/instrumentation/google-http-client/src/main/java/datadog/trace/instrumentation/apachehttpclient/GoogleHttpClientInstrumentation.java
+package datadog.trace.instrumentation.apachehttpclient;
+
+import com.google.auto.service.AutoService;
+import datadog.trace.agent.tooling.Instrumenter;
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.description.type.TypeDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import java.util.Map;
+
+@AutoService(Instrumenter.class)
+public class GoogleHttpClientInstrumentation extends Instrumenter.Default {
+ public GoogleHttpClientInstrumentation() {
+ super("google-http-client");
+ }
+
+ @Override
+ public ElementMatcher<? super TypeDescription> typeMatcher() {
+ return null;
+ }
+
+ @Override
+ public Map<? extends ElementMatcher<? super MethodDescription>, String> transformers() {
+ return null;
+ }
+}

MODIFY
settings.gradle
settings.gradle
@@ -41,6 +41,7 @@ include ':dd-java-agent:instrumentation:elasticsearch:transport-5'
include ':dd-java-agent:instrumentation:elasticsearch:transport-5.3'
include ':dd-java-agent:instrumentation:elasticsearch:transport-6'
include ':dd-java-agent:instrumentation:glassfish'
+include ':dd-java-agent:instrumentation:google-http-client'
include ':dd-java-agent:instrumentation:grpc-1.5'
include ':dd-java-agent:instrumentation:hibernate'
include ':dd-java-agent:instrumentation:hibernate:core-3.3'

Stub google http client integration