diff --git a/agent-bootstrap/agent-bootstrap.gradle b/agent-bootstrap/agent-bootstrap.gradle index 073a0e700b..ceb29d2300 100644 --- a/agent-bootstrap/agent-bootstrap.gradle +++ b/agent-bootstrap/agent-bootstrap.gradle @@ -3,7 +3,7 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" // FIXME: Improve test coverage. minimumBranchCoverage = 0.0 diff --git a/agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMap.java b/agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMap.java index d60357bdcf..964bc3fc01 100644 --- a/agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMap.java +++ b/agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMap.java @@ -15,9 +15,6 @@ */ package io.opentelemetry.auto.bootstrap; -import java.util.HashMap; -import java.util.Map; - /** * Utility to track nested instrumentation. * @@ -25,27 +22,39 @@ import java.util.Map; * #incrementCallDepth at the beginning of each constructor. */ public class CallDepthThreadLocalMap { - private static final ThreadLocal> TLS = - new ThreadLocal>() { + + private static final ClassValue TLS = + new ClassValue() { @Override - public Map initialValue() { - return new HashMap<>(); + protected ThreadLocalDepth computeValue(Class type) { + return new ThreadLocalDepth(); } }; - public static int incrementCallDepth(final Object k) { - final Map map = TLS.get(); - Integer depth = map.get(k); - if (depth == null) { - depth = 0; - } else { - depth += 1; - } - map.put(k, depth); - return depth; + public static int incrementCallDepth(final Class k) { + return TLS.get(k).get().increment(); } - public static void reset(final Object k) { - TLS.get().remove(k); + public static void reset(final Class k) { + TLS.get(k).get().depth = 0; + } + + private static final class Depth { + private int depth; + + private Depth() { + this.depth = 0; + } + + private int increment() { + return this.depth++; + } + } + + private static final class ThreadLocalDepth extends ThreadLocal { + @Override + protected Depth initialValue() { + return new Depth(); + } } } diff --git a/agent-bootstrap/src/test/groovy/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMapTest.groovy b/agent-bootstrap/src/test/groovy/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMapTest.groovy index e5bc5391bb..02fbdce19f 100644 --- a/agent-bootstrap/src/test/groovy/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMapTest.groovy +++ b/agent-bootstrap/src/test/groovy/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMapTest.groovy @@ -21,8 +21,8 @@ class CallDepthThreadLocalMapTest extends Specification { def "test CallDepthThreadLocalMap"() { setup: - def k1 = new Object() - def k2 = new Object() + Class k1 = String + Class k2 = Integer expect: CallDepthThreadLocalMap.incrementCallDepth(k1) == 0 diff --git a/agent-tooling/agent-tooling.gradle b/agent-tooling/agent-tooling.gradle index 6cfb58ff43..53a3bc9ce5 100644 --- a/agent-tooling/agent-tooling.gradle +++ b/agent-tooling/agent-tooling.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" // TODO this is not the desired state, only reflects current reality minimumBranchCoverage = 0 diff --git a/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/matcher/GlobalIgnoresMatcher.java b/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/matcher/GlobalIgnoresMatcher.java index 8ca253e4f0..56c5018973 100644 --- a/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/matcher/GlobalIgnoresMatcher.java +++ b/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/matcher/GlobalIgnoresMatcher.java @@ -153,6 +153,7 @@ public class GlobalIgnoresMatcher || name.contains("javassist") || name.contains(".asm.") || name.contains("$__sisu") + || name.contains("$$EnhancerByProxool$$") || name.startsWith("org.springframework.core.$Proxy")) { return true; } diff --git a/agent-tooling/src/test/groovy/io/opentelemetry/auto/tooling/CacheProviderTest.groovy b/agent-tooling/src/test/groovy/io/opentelemetry/auto/tooling/CacheProviderTest.groovy index 5ffad0f6fb..930a691924 100644 --- a/agent-tooling/src/test/groovy/io/opentelemetry/auto/tooling/CacheProviderTest.groovy +++ b/agent-tooling/src/test/groovy/io/opentelemetry/auto/tooling/CacheProviderTest.groovy @@ -201,7 +201,7 @@ class CacheProviderTest extends AgentSpecification { then: // cache will start to proactively free slots & size calc is approximate - poolStrat.approximateSize() > 0.8 * capacity + poolStrat.approximateSize() >= 0.75 * capacity when: 10.times { diff --git a/auto-exporters/auto-exporters.gradle b/auto-exporters/auto-exporters.gradle index e1c1cc975f..291b77a1ae 100644 --- a/auto-exporters/auto-exporters.gradle +++ b/auto-exporters/auto-exporters.gradle @@ -2,7 +2,7 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" dependencies { testCompile project(':auto-tooling') @@ -20,7 +20,7 @@ tasks.withType(Test).configureEach() { dependsOn ':auto-exporters:opentelemetry-auto-exporters-zipkin:shadowJar' doFirst { systemProperty 'projectVersion', allprojects.version[0] - systemProperty 'adapterRoot', "${rootDir}/auto-exporters" + systemProperty 'adapterRoot', "$rootDir/auto-exporters" systemProperty 'otlpExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-otlp').tasks.shadowJar.archivePath systemProperty 'jaegerExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-jaeger').tasks.shadowJar.archivePath systemProperty 'loggingExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-logging').tasks.shadowJar.archivePath diff --git a/auto-exporters/jaeger/jaeger.gradle b/auto-exporters/jaeger/jaeger.gradle index 6fed947bce..aa3e0f6b17 100644 --- a/auto-exporters/jaeger/jaeger.gradle +++ b/auto-exporters/jaeger/jaeger.gradle @@ -2,8 +2,8 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" -apply from: "${rootDir}/gradle/publish.gradle" +apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/gradle/publish.gradle" dependencies { compile(deps.opentelemetryJaeger) { diff --git a/auto-exporters/logging/logging.gradle b/auto-exporters/logging/logging.gradle index 33399ae0d7..10cb616a23 100644 --- a/auto-exporters/logging/logging.gradle +++ b/auto-exporters/logging/logging.gradle @@ -2,8 +2,8 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" -apply from: "${rootDir}/gradle/publish.gradle" +apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/gradle/publish.gradle" dependencies { compileOnly deps.opentelemetrySdk diff --git a/auto-exporters/otlp/otlp.gradle b/auto-exporters/otlp/otlp.gradle index 2d60081fb6..27ac31e77f 100644 --- a/auto-exporters/otlp/otlp.gradle +++ b/auto-exporters/otlp/otlp.gradle @@ -2,8 +2,8 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" -apply from: "${rootDir}/gradle/publish.gradle" +apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/gradle/publish.gradle" dependencies { compile(deps.opentelemetryOtlp) { diff --git a/auto-exporters/zipkin/zipkin.gradle b/auto-exporters/zipkin/zipkin.gradle index d1c52dee6e..dc8b151a6b 100644 --- a/auto-exporters/zipkin/zipkin.gradle +++ b/auto-exporters/zipkin/zipkin.gradle @@ -2,8 +2,8 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" -apply from: "${rootDir}/gradle/publish.gradle" +apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/gradle/publish.gradle" dependencies { compile(deps.opentelemetryZipkin) { diff --git a/benchmark-integration/benchmark-integration.gradle b/benchmark-integration/benchmark-integration.gradle index a1580e7b23..c61b87cafb 100644 --- a/benchmark-integration/benchmark-integration.gradle +++ b/benchmark-integration/benchmark-integration.gradle @@ -7,7 +7,7 @@ buildscript { } } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" description = 'Integration Level Agent benchmarks.' @@ -16,5 +16,5 @@ targetCompatibility = 1.8 subprojects { sub -> sub.apply plugin: 'com.github.johnrengelman.shadow' - sub.apply from: "${rootDir}/gradle/java.gradle" + sub.apply from: "$rootDir/gradle/java.gradle" } diff --git a/benchmark/benchmark.gradle b/benchmark/benchmark.gradle index ce82a6be31..62271c6b81 100644 --- a/benchmark/benchmark.gradle +++ b/benchmark/benchmark.gradle @@ -2,7 +2,7 @@ plugins { id "me.champeau.gradle.jmh" version "0.5.0" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" dependencies { jmh deps.opentelemetryApi @@ -20,8 +20,8 @@ jmh { timeOnIteration = '20s' iterations = 1 // Number of measurement iterations to do. fork = 1 // How many times to forks a single benchmark. Use 0 to disable forking altogether -// jvmArgs += ["-XX:+UnlockDiagnosticVMOptions", "-XX:+DebugNonSafepoints", "-XX:StartFlightRecording=delay=5s,dumponexit=true,name=jmh-benchmark,filename=${rootDir}/benchmark/build/reports/jmh/jmh-benchmark.jfr"] -// jvmArgs += ["-agentpath:${rootDir}/benchmark/src/jmh/resources/libasyncProfiler.so=start,collapsed,file=${rootDir}/benchmark/build/reports/jmh/profiler.txt"] +// jvmArgs += ["-XX:+UnlockDiagnosticVMOptions", "-XX:+DebugNonSafepoints", "-XX:StartFlightRecording=delay=5s,dumponexit=true,name=jmh-benchmark,filename=$rootDir/benchmark/build/reports/jmh/jmh-benchmark.jfr"] +// jvmArgs += ["-agentpath:$rootDir/benchmark/src/jmh/resources/libasyncProfiler.so=start,collapsed,file=$rootDir/benchmark/build/reports/jmh/profiler.txt"] failOnError = true // Should JMH fail immediately if any benchmark had experienced the unrecoverable error? warmup = '5s' // Time to spend at each warmup iteration. // warmupBatchSize = 10 // Warmup batch size: number of benchmark method calls per operation. diff --git a/gradle/instrumentation.gradle b/gradle/instrumentation.gradle index 126e9ac3a5..bad2751a8c 100644 --- a/gradle/instrumentation.gradle +++ b/gradle/instrumentation.gradle @@ -11,7 +11,7 @@ byteBuddy { } } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" tasks.withType(Test) { forkEvery = 1 diff --git a/gradle/java.gradle b/gradle/java.gradle index 7e4c2b931f..933cda7709 100644 --- a/gradle/java.gradle +++ b/gradle/java.gradle @@ -119,7 +119,6 @@ dependencies { testCompile deps.groovy testCompile deps.testLogging testCompile group: 'info.solidsoft.spock', name: 'spock-global-unroll', version: '0.5.1' - testCompile group: 'com.anotherchrisberry', name: 'spock-retry', version: '0.6.4' testCompile group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.19.0' } diff --git a/instrumentation-core/aws-sdk/aws-sdk-2.2-core/aws-sdk-2.2-core.gradle b/instrumentation-core/aws-sdk/aws-sdk-2.2-core/aws-sdk-2.2-core.gradle index ab14ae9b22..f200df2e11 100644 --- a/instrumentation-core/aws-sdk/aws-sdk-2.2-core/aws-sdk-2.2-core.gradle +++ b/instrumentation-core/aws-sdk/aws-sdk-2.2-core/aws-sdk-2.2-core.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/akka-http-10.0/akka-http-10.0.gradle b/instrumentation/akka-http-10.0/akka-http-10.0.gradle index afa5fb1242..61ca27c79c 100644 --- a/instrumentation/akka-http-10.0/akka-http-10.0.gradle +++ b/instrumentation/akka-http-10.0/akka-http-10.0.gradle @@ -3,8 +3,8 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/apache-httpasyncclient-4.0/apache-httpasyncclient-4.0.gradle b/instrumentation/apache-httpasyncclient-4.0/apache-httpasyncclient-4.0.gradle index 31bdb2f3e4..3a80251883 100644 --- a/instrumentation/apache-httpasyncclient-4.0/apache-httpasyncclient-4.0.gradle +++ b/instrumentation/apache-httpasyncclient-4.0/apache-httpasyncclient-4.0.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/apache-httpclient/apache-httpclient-2.0/apache-httpclient-2.0.gradle b/instrumentation/apache-httpclient/apache-httpclient-2.0/apache-httpclient-2.0.gradle index e4014c3138..072a9e546e 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-2.0/apache-httpclient-2.0.gradle +++ b/instrumentation/apache-httpclient/apache-httpclient-2.0/apache-httpclient-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/apache-httpclient-4.0.gradle b/instrumentation/apache-httpclient/apache-httpclient-4.0/apache-httpclient-4.0.gradle index 940cef9da2..ac9f9dc9fb 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.0/apache-httpclient-4.0.gradle +++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/apache-httpclient-4.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/aws-sdk-1.11.gradle b/instrumentation/aws-sdk/aws-sdk-1.11/aws-sdk-1.11.gradle index 3f2af3265d..6edfa13108 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/aws-sdk-1.11.gradle +++ b/instrumentation/aws-sdk/aws-sdk-1.11/aws-sdk-1.11.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' // compiling against 1.11.0, but instrumentation should work against 1.10.33 with varying effects, diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/aws-sdk-2.2.gradle b/instrumentation/aws-sdk/aws-sdk-2.2/aws-sdk-2.2.gradle index 8cd5b51581..6eb457f10d 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/aws-sdk-2.2.gradle +++ b/instrumentation/aws-sdk/aws-sdk-2.2/aws-sdk-2.2.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/cassandra/cassandra-3.0/cassandra-3.0.gradle b/instrumentation/cassandra/cassandra-3.0/cassandra-3.0.gradle index 91287913f0..dc3b45e262 100644 --- a/instrumentation/cassandra/cassandra-3.0/cassandra-3.0.gradle +++ b/instrumentation/cassandra/cassandra-3.0/cassandra-3.0.gradle @@ -6,7 +6,7 @@ ext { cassandraDriverTestVersions = "[3.0,4.0)" } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/cassandra/cassandra-4.0/cassandra-4.0.gradle b/instrumentation/cassandra/cassandra-4.0/cassandra-4.0.gradle index 18b1b8856c..a721d5c93f 100644 --- a/instrumentation/cassandra/cassandra-4.0/cassandra-4.0.gradle +++ b/instrumentation/cassandra/cassandra-4.0/cassandra-4.0.gradle @@ -5,7 +5,7 @@ ext { cassandraDriverTestVersions = "[4.0,)" } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/cdi-testing/cdi-testing.gradle b/instrumentation/cdi-testing/cdi-testing.gradle index e8e644b1e9..52d9802cfd 100644 --- a/instrumentation/cdi-testing/cdi-testing.gradle +++ b/instrumentation/cdi-testing/cdi-testing.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/couchbase/couchbase-2.0/couchbase-2.0.gradle b/instrumentation/couchbase/couchbase-2.0/couchbase-2.0.gradle index 7cc5dec3ca..1f1253319a 100644 --- a/instrumentation/couchbase/couchbase-2.0/couchbase-2.0.gradle +++ b/instrumentation/couchbase/couchbase-2.0/couchbase-2.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/couchbase/couchbase-2.6/couchbase-2.6.gradle b/instrumentation/couchbase/couchbase-2.6/couchbase-2.6.gradle index 8c1d74febe..df7404affc 100644 --- a/instrumentation/couchbase/couchbase-2.6/couchbase-2.6.gradle +++ b/instrumentation/couchbase/couchbase-2.6/couchbase-2.6.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/dropwizard-testing/dropwizard-testing.gradle b/instrumentation/dropwizard-testing/dropwizard-testing.gradle index fbef74cc8f..81206b6957 100644 --- a/instrumentation/dropwizard-testing/dropwizard-testing.gradle +++ b/instrumentation/dropwizard-testing/dropwizard-testing.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" //apply plugin: 'org.unbroken-dome.test-sets' // diff --git a/instrumentation/dropwizard-views-0.7/dropwizard-views-0.7.gradle b/instrumentation/dropwizard-views-0.7/dropwizard-views-0.7.gradle index da201ec1ed..932983f503 100644 --- a/instrumentation/dropwizard-views-0.7/dropwizard-views-0.7.gradle +++ b/instrumentation/dropwizard-views-0.7/dropwizard-views-0.7.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/elasticsearch/elasticsearch-common/elasticsearch-common.gradle b/instrumentation/elasticsearch/elasticsearch-common/elasticsearch-common.gradle index a2a368e1c8..4e57f0e3f5 100644 --- a/instrumentation/elasticsearch/elasticsearch-common/elasticsearch-common.gradle +++ b/instrumentation/elasticsearch/elasticsearch-common/elasticsearch-common.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" dependencies { compileOnly group: 'org.elasticsearch.client', name: 'rest', version: '5.0.0' diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/elasticsearch-rest-5.0.gradle b/instrumentation/elasticsearch/elasticsearch-rest-5.0/elasticsearch-rest-5.0.gradle index c0064b215a..c0c65f9cf3 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/elasticsearch-rest-5.0.gradle +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/elasticsearch-rest-5.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy index e9009e8c0e..15713fad72 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy @@ -18,7 +18,6 @@ import io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpClientDecor import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig import org.apache.http.util.EntityUtils @@ -27,6 +26,8 @@ import org.elasticsearch.client.RestClient import org.elasticsearch.client.RestClientBuilder import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings +import org.elasticsearch.common.transport.TransportAddress +import org.elasticsearch.http.HttpServerTransport import org.elasticsearch.node.InternalSettingsPreparer import org.elasticsearch.node.Node import org.elasticsearch.transport.Netty4Plugin @@ -37,26 +38,18 @@ import static io.opentelemetry.trace.Span.Kind.INTERNAL class Elasticsearch6RestClientTest extends AgentTestRunner { @Shared - int httpPort - @Shared - int tcpPort + TransportAddress httpTransportAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared RestClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -64,14 +57,13 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) - .put("cluster.name", "test-cluster") + .put("cluster.name", clusterName) .build() testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin]) testNode.start() + httpTransportAddress = testNode.injector().getInstance(HttpServerTransport).boundAddress().publishAddress() - client = RestClient.builder(new HttpHost("localhost", httpPort)) + client = RestClient.builder(new HttpHost(httpTransportAddress.address, httpTransportAddress.port)) .setMaxRetryTimeoutMillis(Integer.MAX_VALUE) .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() { @Override @@ -107,8 +99,8 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { spanKind INTERNAL parent() tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_PORT" httpPort + "$MoreTags.NET_PEER_NAME" httpTransportAddress.address + "$MoreTags.NET_PEER_PORT" httpTransportAddress.port "$Tags.HTTP_URL" "_cluster/health" "$Tags.HTTP_METHOD" "GET" "$Tags.DB_TYPE" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/test/groovy/Elasticsearch5RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/test/groovy/Elasticsearch5RestClientTest.groovy index ebaecbf740..16be3f05e1 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/test/groovy/Elasticsearch5RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/src/test/groovy/Elasticsearch5RestClientTest.groovy @@ -18,7 +18,6 @@ import io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpClientDecor import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig import org.apache.http.util.EntityUtils @@ -27,7 +26,9 @@ import org.elasticsearch.client.RestClient import org.elasticsearch.client.RestClientBuilder import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.env.Environment +import org.elasticsearch.http.HttpServerTransport import org.elasticsearch.node.Node import org.elasticsearch.node.internal.InternalSettingsPreparer import org.elasticsearch.transport.Netty3Plugin @@ -39,26 +40,18 @@ import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING class Elasticsearch5RestClientTest extends AgentTestRunner { @Shared - int httpPort - @Shared - int tcpPort + TransportAddress httpTransportAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared static RestClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -66,16 +59,15 @@ class Elasticsearch5RestClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .put("transport.type", "netty3") .put("http.type", "netty3") - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin]) testNode.start() + httpTransportAddress = testNode.injector().getInstance(HttpServerTransport).boundAddress().publishAddress() - client = RestClient.builder(new HttpHost("localhost", httpPort)) + client = RestClient.builder(new HttpHost(httpTransportAddress.address, httpTransportAddress.port)) .setMaxRetryTimeoutMillis(Integer.MAX_VALUE) .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() { @Override @@ -111,8 +103,8 @@ class Elasticsearch5RestClientTest extends AgentTestRunner { spanKind INTERNAL parent() tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_PORT" httpPort + "$MoreTags.NET_PEER_NAME" httpTransportAddress.address + "$MoreTags.NET_PEER_PORT" httpTransportAddress.port "$Tags.HTTP_URL" "_cluster/health" "$Tags.HTTP_METHOD" "GET" "$Tags.DB_TYPE" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-rest-6.4/elasticsearch-rest-6.4.gradle b/instrumentation/elasticsearch/elasticsearch-rest-6.4/elasticsearch-rest-6.4.gradle index 7322de5ff2..90ffbd3e9e 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-6.4/elasticsearch-rest-6.4.gradle +++ b/instrumentation/elasticsearch/elasticsearch-rest-6.4/elasticsearch-rest-6.4.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy index ba4f2fc22b..6b5d5309c2 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy @@ -18,7 +18,6 @@ import io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpClientDecor import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig import org.apache.http.util.EntityUtils @@ -28,7 +27,9 @@ import org.elasticsearch.client.RestClient import org.elasticsearch.client.RestClientBuilder import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.env.Environment +import org.elasticsearch.http.HttpServerTransport import org.elasticsearch.node.InternalSettingsPreparer import org.elasticsearch.node.Node import org.elasticsearch.plugins.Plugin @@ -39,10 +40,9 @@ import static io.opentelemetry.trace.Span.Kind.CLIENT import static io.opentelemetry.trace.Span.Kind.INTERNAL class Elasticsearch6RestClientTest extends AgentTestRunner { + @Shared - int httpPort - @Shared - int tcpPort + TransportAddress httpTransportAddress @Shared Node testNode @Shared @@ -50,16 +50,10 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { @Shared RestClient client + @Shared + String clusterName = UUID.randomUUID().toString() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -67,14 +61,13 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) - .put("cluster.name", "test-cluster") + .put("cluster.name", clusterName) .build() testNode = new TestNode(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin]) testNode.start() + httpTransportAddress = testNode.injector().getInstance(HttpServerTransport).boundAddress().publishAddress() - client = RestClient.builder(new HttpHost("localhost", httpPort)) + client = RestClient.builder(new HttpHost(httpTransportAddress.address, httpTransportAddress.port)) .setMaxRetryTimeoutMillis(Integer.MAX_VALUE) .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() { @Override @@ -111,8 +104,8 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { spanKind INTERNAL parent() tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_PORT" httpPort + "$MoreTags.NET_PEER_NAME" httpTransportAddress.address + "$MoreTags.NET_PEER_PORT" httpTransportAddress.port "$Tags.HTTP_URL" "_cluster/health" "$Tags.HTTP_METHOD" "GET" "$Tags.DB_TYPE" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/test/groovy/Elasticsearch6RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/test/groovy/Elasticsearch6RestClientTest.groovy index e9009e8c0e..15713fad72 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/test/groovy/Elasticsearch6RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-6.4/src/test/groovy/Elasticsearch6RestClientTest.groovy @@ -18,7 +18,6 @@ import io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpClientDecor import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig import org.apache.http.util.EntityUtils @@ -27,6 +26,8 @@ import org.elasticsearch.client.RestClient import org.elasticsearch.client.RestClientBuilder import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings +import org.elasticsearch.common.transport.TransportAddress +import org.elasticsearch.http.HttpServerTransport import org.elasticsearch.node.InternalSettingsPreparer import org.elasticsearch.node.Node import org.elasticsearch.transport.Netty4Plugin @@ -37,26 +38,18 @@ import static io.opentelemetry.trace.Span.Kind.INTERNAL class Elasticsearch6RestClientTest extends AgentTestRunner { @Shared - int httpPort - @Shared - int tcpPort + TransportAddress httpTransportAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared RestClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -64,14 +57,13 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) - .put("cluster.name", "test-cluster") + .put("cluster.name", clusterName) .build() testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin]) testNode.start() + httpTransportAddress = testNode.injector().getInstance(HttpServerTransport).boundAddress().publishAddress() - client = RestClient.builder(new HttpHost("localhost", httpPort)) + client = RestClient.builder(new HttpHost(httpTransportAddress.address, httpTransportAddress.port)) .setMaxRetryTimeoutMillis(Integer.MAX_VALUE) .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() { @Override @@ -107,8 +99,8 @@ class Elasticsearch6RestClientTest extends AgentTestRunner { spanKind INTERNAL parent() tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_PORT" httpPort + "$MoreTags.NET_PEER_NAME" httpTransportAddress.address + "$MoreTags.NET_PEER_PORT" httpTransportAddress.port "$Tags.HTTP_URL" "_cluster/health" "$Tags.HTTP_METHOD" "GET" "$Tags.DB_TYPE" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/elasticsearch-transport-2.0.gradle b/instrumentation/elasticsearch/elasticsearch-transport-2.0/elasticsearch-transport-2.0.gradle index ddbbe54753..a5f7b85839 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/elasticsearch-transport-2.0.gradle +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/elasticsearch-transport-2.0.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2NodeClientTest.groovy index 01f9aea48d..9dd0d32c46 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2NodeClientTest.groovy @@ -15,13 +15,14 @@ */ import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.index.IndexNotFoundException import org.elasticsearch.node.Node import org.elasticsearch.node.NodeBuilder +import org.elasticsearch.transport.TransportService import spock.lang.Shared import static io.opentelemetry.auto.test.utils.TraceUtils.runUnderTrace @@ -31,25 +32,17 @@ class Elasticsearch2NodeClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds @Shared - int httpPort - @Shared - int tcpPort + TransportAddress tcpPublishAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() def client = testNode.client() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -59,11 +52,10 @@ class Elasticsearch2NodeClientTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("threadpool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .build() - testNode = NodeBuilder.newInstance().local(true).clusterName("test-cluster").settings(settings).build() + testNode = NodeBuilder.newInstance().local(true).clusterName(clusterName).settings(settings).build() testNode.start() + tcpPublishAddress = testNode.injector().getInstance(TransportService).boundAddress().publishAddress() runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call // into a top level trace to get exactly one trace in the result. diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2TransportClientTest.groovy index 166abd77b8..5510d9dfe7 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/Elasticsearch2TransportClientTest.groovy @@ -16,16 +16,17 @@ import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest +import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest import org.elasticsearch.client.transport.TransportClient import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings -import org.elasticsearch.common.transport.InetSocketTransportAddress +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.index.IndexNotFoundException import org.elasticsearch.node.Node import org.elasticsearch.node.NodeBuilder import org.elasticsearch.transport.RemoteTransportException +import org.elasticsearch.transport.TransportService import spock.lang.Shared import static io.opentelemetry.auto.test.utils.TraceUtils.runUnderTrace @@ -35,26 +36,18 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds @Shared - int httpPort - @Shared - int tcpPort + TransportAddress tcpPublishAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared TransportClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -62,20 +55,20 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .build() - testNode = NodeBuilder.newInstance().clusterName("test-cluster").settings(settings).build() + testNode = NodeBuilder.newInstance().clusterName(clusterName).settings(settings).build() testNode.start() + tcpPublishAddress = testNode.injector().getInstance(TransportService).boundAddress().publishAddress() + client = TransportClient.builder().settings( Settings.builder() // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("threadpool.listener.size", 1) - .put("cluster.name", "test-cluster") + .put("cluster.name", clusterName) .build() ).build() - client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), tcpPort)) + client.addTransportAddress(tcpPublishAddress) runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call // into a top level trace to get exactly one trace in the result. @@ -107,9 +100,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "ClusterHealthAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -119,6 +112,36 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { } } + def "test elasticsearch stats"() { + setup: + def result = client.admin().cluster().clusterStats(new ClusterStatsRequest(new String[0])) + + def status = result.get().status + def failures = result.get().failures() + + expect: + status.name() == "GREEN" + failures == null + + assertTraces(1) { + trace(0, 1) { + span(0) { + operationName "ClusterStatsAction" + spanKind CLIENT + tags { + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port + "$Tags.DB_TYPE" "elasticsearch" + "elasticsearch.action" "ClusterStatsAction" + "elasticsearch.request" "ClusterStatsRequest" + "elasticsearch.node.cluster.name" clusterName + } + } + } + } + } + def "test elasticsearch error"() { when: client.prepareGet(indexName, indexType, id).get() @@ -202,9 +225,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "CreateIndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "CreateIndexAction" "elasticsearch.request" "CreateIndexRequest" @@ -217,9 +240,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "ClusterHealthAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -231,9 +254,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" @@ -261,9 +284,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "IndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "IndexAction" "elasticsearch.request" "IndexRequest" @@ -277,9 +300,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy index da6b7c7764..cdc9b1af20 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy @@ -32,6 +32,7 @@ class Elasticsearch2SpringRepositoryTest extends AgentTestRunner { DocRepository repo = applicationContext.getBean(DocRepository) def setup() { + repo.refresh() TEST_WRITER.clear() runUnderTrace("delete") { repo.deleteAll() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy index d0de3aa5f6..c55bd8147d 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/latestDepTest/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy @@ -17,7 +17,6 @@ package springdata import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.search.SearchResponse import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -40,27 +39,17 @@ import static io.opentelemetry.trace.Span.Kind.CLIENT class Elasticsearch2SpringTemplateTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared ElasticsearchTemplate template def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -70,10 +59,8 @@ class Elasticsearch2SpringTemplateTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("threadpool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .build() - testNode = NodeBuilder.newInstance().local(true).clusterName("test-cluster").settings(settings).build() + testNode = NodeBuilder.newInstance().local(true).clusterName(clusterName).settings(settings).build() testNode.start() template = new ElasticsearchTemplate(testNode.client()) diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2NodeClientTest.groovy index 1206b6facd..937ba2f07c 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2NodeClientTest.groovy @@ -16,7 +16,6 @@ import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -31,26 +30,16 @@ import static io.opentelemetry.trace.Span.Kind.CLIENT class Elasticsearch2NodeClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() def client = testNode.client() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -60,10 +49,8 @@ class Elasticsearch2NodeClientTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("threadpool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .build() - testNode = NodeBuilder.newInstance().local(true).clusterName("test-cluster").settings(settings).build() + testNode = NodeBuilder.newInstance().local(true).clusterName(clusterName).settings(settings).build() testNode.start() runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2TransportClientTest.groovy index 84c64abac8..a8bbe418c3 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/Elasticsearch2TransportClientTest.groovy @@ -16,17 +16,17 @@ import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest import org.elasticsearch.client.transport.TransportClient import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings -import org.elasticsearch.common.transport.InetSocketTransportAddress +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.index.IndexNotFoundException import org.elasticsearch.node.Node import org.elasticsearch.node.NodeBuilder import org.elasticsearch.transport.RemoteTransportException +import org.elasticsearch.transport.TransportService import spock.lang.Shared import static io.opentelemetry.auto.test.utils.TraceUtils.runUnderTrace @@ -36,26 +36,18 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds @Shared - int httpPort - @Shared - int tcpPort + TransportAddress tcpPublishAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared TransportClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -63,20 +55,19 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .build() - testNode = NodeBuilder.newInstance().clusterName("test-cluster").settings(settings).build() + testNode = NodeBuilder.newInstance().clusterName(clusterName).settings(settings).build() testNode.start() + tcpPublishAddress = testNode.injector().getInstance(TransportService).boundAddress().publishAddress() client = TransportClient.builder().settings( Settings.builder() // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("threadpool.listener.size", 1) - .put("cluster.name", "test-cluster") + .put("cluster.name", clusterName) .build() ).build() - client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), tcpPort)) + client.addTransportAddress(tcpPublishAddress) runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call // into a top level trace to get exactly one trace in the result. @@ -108,9 +99,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "ClusterHealthAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -136,13 +127,13 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { span(0) { operationName "ClusterStatsAction" tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterStatsAction" "elasticsearch.request" "ClusterStatsRequest" - "elasticsearch.node.cluster.name" "test-cluster" + "elasticsearch.node.cluster.name" clusterName } } } @@ -232,9 +223,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "CreateIndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "CreateIndexAction" "elasticsearch.request" "CreateIndexRequest" @@ -247,9 +238,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "ClusterHealthAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -261,9 +252,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" @@ -291,9 +282,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "IndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "IndexAction" "elasticsearch.request" "IndexRequest" @@ -307,9 +298,9 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "127.0.0.1" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy index 7f45989658..76318eaefa 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringRepositoryTest.groovy @@ -33,6 +33,7 @@ class Elasticsearch2SpringRepositoryTest extends AgentTestRunner { DocRepository repo = applicationContext.getBean(DocRepository) def setup() { + repo.refresh() TEST_WRITER.clear() runUnderTrace("delete") { repo.deleteAll() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy index b08e836096..c245559c51 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-2.0/src/test/groovy/springdata/Elasticsearch2SpringTemplateTest.groovy @@ -18,7 +18,6 @@ package springdata import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.search.SearchResponse import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -41,27 +40,17 @@ import static io.opentelemetry.trace.Span.Kind.CLIENT class Elasticsearch2SpringTemplateTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared ElasticsearchTemplate template def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -71,10 +60,8 @@ class Elasticsearch2SpringTemplateTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("threadpool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .build() - testNode = NodeBuilder.newInstance().local(true).clusterName("test-cluster").settings(settings).build() + testNode = NodeBuilder.newInstance().local(true).clusterName(clusterName).settings(settings).build() testNode.start() template = new ElasticsearchTemplate(testNode.client()) diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/elasticsearch-transport-5.0.gradle b/instrumentation/elasticsearch/elasticsearch-transport-5.0/elasticsearch-transport-5.0.gradle index 7ada0f973e..1b17f9b60e 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/elasticsearch-transport-5.0.gradle +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/elasticsearch-transport-5.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5NodeClientTest.groovy index c53b853cf5..3cf16bd6e3 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5NodeClientTest.groovy @@ -15,7 +15,6 @@ */ import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -33,26 +32,16 @@ import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING class Elasticsearch5NodeClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() def client = testNode.client() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -62,11 +51,9 @@ class Elasticsearch5NodeClientTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .put("transport.type", "netty3") .put("http.type", "netty3") - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin]) testNode.start() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5TransportClientTest.groovy index 1e9175910d..63db8ebb8a 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/src/test/groovy/Elasticsearch5TransportClientTest.groovy @@ -16,18 +16,18 @@ import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.client.transport.TransportClient import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings -import org.elasticsearch.common.transport.InetSocketTransportAddress +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.env.Environment import org.elasticsearch.index.IndexNotFoundException import org.elasticsearch.node.Node import org.elasticsearch.node.internal.InternalSettingsPreparer import org.elasticsearch.transport.Netty3Plugin import org.elasticsearch.transport.RemoteTransportException +import org.elasticsearch.transport.TransportService import org.elasticsearch.transport.client.PreBuiltTransportClient import spock.lang.Shared @@ -39,26 +39,18 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds @Shared - int httpPort - @Shared - int tcpPort + TransportAddress tcpPublishAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared TransportClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -66,23 +58,22 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .put("transport.type", "netty3") .put("http.type", "netty3") - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin]) testNode.start() + tcpPublishAddress = testNode.injector().getInstance(TransportService).boundAddress().publishAddress() client = new PreBuiltTransportClient( Settings.builder() // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() ) - client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), tcpPort)) + client.addTransportAddress(tcpPublishAddress) runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call // into a top level trace to get exactly one trace in the result. @@ -114,9 +105,9 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { operationName "ClusterHealthAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" String - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -209,9 +200,9 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { operationName "CreateIndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" String - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "CreateIndexAction" "elasticsearch.request" "CreateIndexRequest" @@ -224,9 +215,9 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" String - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" @@ -253,9 +244,9 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { operationName "IndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" String - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "IndexAction" "elasticsearch.request" "IndexRequest" @@ -273,9 +264,9 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" String - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/elasticsearch-transport-5.3.gradle b/instrumentation/elasticsearch/elasticsearch-transport-5.3/elasticsearch-transport-5.3.gradle index d232404990..519e53ace6 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/elasticsearch-transport-5.3.gradle +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/elasticsearch-transport-5.3.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53NodeClientTest.groovy index 4d68341a44..84b35d927e 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53NodeClientTest.groovy @@ -15,7 +15,6 @@ */ import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -33,26 +32,16 @@ import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING class Elasticsearch53NodeClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() def client = testNode.client() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -62,11 +51,9 @@ class Elasticsearch53NodeClientTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .put("transport.type", "netty3") .put("http.type", "netty3") - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin]) testNode.start() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53TransportClientTest.groovy index 0bb8645556..b1546f946f 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/Elasticsearch53TransportClientTest.groovy @@ -16,18 +16,18 @@ import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.client.transport.TransportClient import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings -import org.elasticsearch.common.transport.InetSocketTransportAddress +import org.elasticsearch.common.transport.TransportAddress import org.elasticsearch.env.Environment import org.elasticsearch.index.IndexNotFoundException import org.elasticsearch.node.InternalSettingsPreparer import org.elasticsearch.node.Node import org.elasticsearch.transport.Netty3Plugin import org.elasticsearch.transport.RemoteTransportException +import org.elasticsearch.transport.TransportService import org.elasticsearch.transport.client.PreBuiltTransportClient import spock.lang.Shared @@ -39,9 +39,8 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds @Shared - int httpPort - @Shared - int tcpPort + TransportAddress tcpPublishAddress + @Shared Node testNode @Shared @@ -49,16 +48,10 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { @Shared TransportClient client + @Shared + String clusterName = UUID.randomUUID().toString() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -66,23 +59,22 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .put("transport.type", "netty3") .put("http.type", "netty3") - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin]) testNode.start() + tcpPublishAddress = testNode.injector().getInstance(TransportService).boundAddress().publishAddress() client = new PreBuiltTransportClient( Settings.builder() // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() ) - client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), tcpPort)) + client.addTransportAddress(tcpPublishAddress) runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call // into a top level trace to get exactly one trace in the result. @@ -114,9 +106,9 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { operationName "ClusterHealthAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -209,9 +201,9 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { operationName "CreateIndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "CreateIndexAction" "elasticsearch.request" "CreateIndexRequest" @@ -224,9 +216,9 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" @@ -253,9 +245,9 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { operationName "IndexAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "IndexAction" "elasticsearch.request" "IndexRequest" @@ -274,9 +266,9 @@ class Elasticsearch53TransportClientTest extends AgentTestRunner { operationName "GetAction" spanKind CLIENT tags { - "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_NAME" tcpPublishAddress.host + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy index 4056199249..1b0df5b50d 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy @@ -61,6 +61,7 @@ class Elasticsearch53SpringRepositoryTest extends AgentTestRunner { } def setup() { + repo.refresh() TEST_WRITER.clear() runUnderTrace("delete") { repo.deleteAll() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy index f0cad53032..451a61b921 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy @@ -18,7 +18,6 @@ package springdata import com.google.common.collect.ImmutableSet import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.search.SearchResponse import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -50,27 +49,17 @@ class Elasticsearch53SpringTemplateTest extends AgentTestRunner { // TODO: check if other ES tests need this protection and potentially pull this into global class public static final Set IGNORED_ACTIONS = ImmutableSet.of("NodesStatsAction", "IndicesStatsAction") - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared ElasticsearchTemplate template def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -80,11 +69,9 @@ class Elasticsearch53SpringTemplateTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) .put("transport.type", "netty3") .put("http.type", "netty3") - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin]) testNode.start() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/elasticsearch-transport-6.0.gradle b/instrumentation/elasticsearch/elasticsearch-transport-6.0/elasticsearch-transport-6.0.gradle index 9145bac798..6dbaff85ed 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/elasticsearch-transport-6.0.gradle +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/elasticsearch-transport-6.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6NodeClientTest.groovy index ffcb222c1f..f7d29a0ed4 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6NodeClientTest.groovy @@ -15,7 +15,6 @@ */ import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils import org.elasticsearch.common.settings.Settings @@ -32,26 +31,16 @@ import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING class Elasticsearch6NodeClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds - @Shared - int httpPort - @Shared - int tcpPort @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() def client = testNode.client() def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() @@ -61,9 +50,7 @@ class Elasticsearch6NodeClientTest extends AgentTestRunner { .put("path.home", esWorkingDir.path) // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin]) testNode.start() diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6TransportClientTest.groovy index 4845959ee0..70d80a9b6a 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/src/test/groovy/Elasticsearch6TransportClientTest.groovy @@ -16,7 +16,6 @@ import io.opentelemetry.auto.instrumentation.api.MoreTags import io.opentelemetry.auto.instrumentation.api.Tags import io.opentelemetry.auto.test.AgentTestRunner -import io.opentelemetry.auto.test.utils.PortUtils import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.client.transport.TransportClient import org.elasticsearch.common.io.FileSystemUtils @@ -27,6 +26,7 @@ import org.elasticsearch.node.InternalSettingsPreparer import org.elasticsearch.node.Node import org.elasticsearch.transport.Netty4Plugin import org.elasticsearch.transport.RemoteTransportException +import org.elasticsearch.transport.TransportService import org.elasticsearch.transport.client.PreBuiltTransportClient import spock.lang.Shared @@ -38,48 +38,38 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner { public static final long TIMEOUT = 10000; // 10 seconds @Shared - int httpPort - @Shared - int tcpPort + TransportAddress tcpPublishAddress @Shared Node testNode @Shared File esWorkingDir + @Shared + String clusterName = UUID.randomUUID().toString() @Shared TransportClient client def setupSpec() { - withRetryOnBindException({ - setupSpecUnderRetry() - }) - } - - def setupSpecUnderRetry() { - httpPort = PortUtils.randomOpenPort() - tcpPort = PortUtils.randomOpenPort() - esWorkingDir = File.createTempDir("test-es-working-dir-", "") esWorkingDir.deleteOnExit() println "ES work dir: $esWorkingDir" def settings = Settings.builder() .put("path.home", esWorkingDir.path) - .put("http.port", httpPort) - .put("transport.tcp.port", tcpPort) - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin]) testNode.start() + tcpPublishAddress = testNode.injector().getInstance(TransportService).boundAddress().publishAddress() client = new PreBuiltTransportClient( Settings.builder() // Since we use listeners to close spans this should make our span closing deterministic which is good for tests .put("thread_pool.listener.size", 1) - .put(CLUSTER_NAME_SETTING.getKey(), "test-cluster") + .put(CLUSTER_NAME_SETTING.getKey(), clusterName) .build() ) - client.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), tcpPort)) + client.addTransportAddress(tcpPublishAddress) runUnderTrace("setup") { // this may potentially create multiple requests and therefore multiple spans, so we wrap this call // into a top level trace to get exactly one trace in the result. @@ -112,8 +102,8 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner { spanKind CLIENT tags { "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "ClusterHealthAction" "elasticsearch.request" "ClusterHealthRequest" @@ -207,8 +197,8 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner { spanKind CLIENT tags { "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "CreateIndexAction" "elasticsearch.request" "CreateIndexRequest" @@ -222,8 +212,8 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner { spanKind CLIENT tags { "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" @@ -251,8 +241,8 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner { spanKind CLIENT tags { "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "IndexAction" "elasticsearch.request" "IndexRequest" @@ -272,8 +262,8 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner { spanKind CLIENT tags { "$MoreTags.NET_PEER_NAME" "localhost" - "$MoreTags.NET_PEER_IP" "127.0.0.1" - "$MoreTags.NET_PEER_PORT" tcpPort + "$MoreTags.NET_PEER_IP" tcpPublishAddress.address + "$MoreTags.NET_PEER_PORT" tcpPublishAddress.port "$Tags.DB_TYPE" "elasticsearch" "elasticsearch.action" "GetAction" "elasticsearch.request" "GetRequest" diff --git a/instrumentation/finatra-2.9/finatra-2.9.gradle b/instrumentation/finatra-2.9/finatra-2.9.gradle index 0d37ca61a4..f996c07f5b 100644 --- a/instrumentation/finatra-2.9/finatra-2.9.gradle +++ b/instrumentation/finatra-2.9/finatra-2.9.gradle @@ -3,8 +3,8 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/geode-1.4/geode-1.4.gradle b/instrumentation/geode-1.4/geode-1.4.gradle index 633ba73f3f..1675df844c 100644 --- a/instrumentation/geode-1.4/geode-1.4.gradle +++ b/instrumentation/geode-1.4/geode-1.4.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' diff --git a/instrumentation/google-http-client-1.19/google-http-client-1.19.gradle b/instrumentation/google-http-client-1.19/google-http-client-1.19.gradle index 7f08affe47..b8115e8657 100644 --- a/instrumentation/google-http-client-1.19/google-http-client-1.19.gradle +++ b/instrumentation/google-http-client-1.19/google-http-client-1.19.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/grizzly-2.0/grizzly-2.0.gradle b/instrumentation/grizzly-2.0/grizzly-2.0.gradle index d526e3ad76..80f16c4230 100644 --- a/instrumentation/grizzly-2.0/grizzly-2.0.gradle +++ b/instrumentation/grizzly-2.0/grizzly-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/grizzly-client-1.9/grizzly-client-1.9.gradle b/instrumentation/grizzly-client-1.9/grizzly-client-1.9.gradle index 080b739fd1..8317c75e77 100644 --- a/instrumentation/grizzly-client-1.9/grizzly-client-1.9.gradle +++ b/instrumentation/grizzly-client-1.9/grizzly-client-1.9.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle b/instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle index 310ca9b06c..4768a82e20 100644 --- a/instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle +++ b/instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/grpc-1.5/grpc-1.5.gradle b/instrumentation/grpc-1.5/grpc-1.5.gradle index bc39a66996..953ddea29c 100644 --- a/instrumentation/grpc-1.5/grpc-1.5.gradle +++ b/instrumentation/grpc-1.5/grpc-1.5.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' apply plugin: 'com.google.protobuf' diff --git a/instrumentation/hibernate/hibernate-3.3/hibernate-3.3.gradle b/instrumentation/hibernate/hibernate-3.3/hibernate-3.3.gradle index b8a29653e4..7a263901de 100644 --- a/instrumentation/hibernate/hibernate-3.3/hibernate-3.3.gradle +++ b/instrumentation/hibernate/hibernate-3.3/hibernate-3.3.gradle @@ -5,7 +5,7 @@ * instrumentation isn't able to reference it. */ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/hibernate/hibernate-4.0/hibernate-4.0.gradle b/instrumentation/hibernate/hibernate-4.0/hibernate-4.0.gradle index d130652ee5..536b6318af 100644 --- a/instrumentation/hibernate/hibernate-4.0/hibernate-4.0.gradle +++ b/instrumentation/hibernate/hibernate-4.0/hibernate-4.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/hibernate/hibernate-4.3/hibernate-4.3.gradle b/instrumentation/hibernate/hibernate-4.3/hibernate-4.3.gradle index b44ac8da66..9838e244d3 100644 --- a/instrumentation/hibernate/hibernate-4.3/hibernate-4.3.gradle +++ b/instrumentation/hibernate/hibernate-4.3/hibernate-4.3.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/hibernate/hibernate-common/hibernate-common.gradle b/instrumentation/hibernate/hibernate-common/hibernate-common.gradle index ee87ccb1a7..dba9283db5 100644 --- a/instrumentation/hibernate/hibernate-common/hibernate-common.gradle +++ b/instrumentation/hibernate/hibernate-common/hibernate-common.gradle @@ -2,4 +2,4 @@ * Classes that are common to all versions of the Hibernate instrumentation. */ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" diff --git a/instrumentation/http-url-connection/http-url-connection.gradle b/instrumentation/http-url-connection/http-url-connection.gradle index 5d37150415..f28010a9d2 100644 --- a/instrumentation/http-url-connection/http-url-connection.gradle +++ b/instrumentation/http-url-connection/http-url-connection.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/hystrix-1.4/hystrix-1.4.gradle b/instrumentation/hystrix-1.4/hystrix-1.4.gradle index 90440b86ac..aec2d3510f 100644 --- a/instrumentation/hystrix-1.4/hystrix-1.4.gradle +++ b/instrumentation/hystrix-1.4/hystrix-1.4.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/instrumentation.gradle b/instrumentation/instrumentation.gradle index bad5d9852f..94f45b69d8 100644 --- a/instrumentation/instrumentation.gradle +++ b/instrumentation/instrumentation.gradle @@ -13,7 +13,7 @@ buildscript { plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" Project instr_project = project subprojects { diff --git a/instrumentation/java-class-loader/java-class-loader.gradle b/instrumentation/java-class-loader/java-class-loader.gradle index cea0b75744..80b3cc1b15 100644 --- a/instrumentation/java-class-loader/java-class-loader.gradle +++ b/instrumentation/java-class-loader/java-class-loader.gradle @@ -1 +1 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" diff --git a/instrumentation/java-class-loader/jboss-testing/jboss-testing.gradle b/instrumentation/java-class-loader/jboss-testing/jboss-testing.gradle index c584adee28..74ebe33832 100644 --- a/instrumentation/java-class-loader/jboss-testing/jboss-testing.gradle +++ b/instrumentation/java-class-loader/jboss-testing/jboss-testing.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" dependencies { testCompile project(':instrumentation:java-class-loader') diff --git a/instrumentation/java-class-loader/osgi-testing/osgi-testing.gradle b/instrumentation/java-class-loader/osgi-testing/osgi-testing.gradle index ddb8c0c91d..4a030c77b3 100644 --- a/instrumentation/java-class-loader/osgi-testing/osgi-testing.gradle +++ b/instrumentation/java-class-loader/osgi-testing/osgi-testing.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" dependencies { testCompile project(':instrumentation:java-class-loader') diff --git a/instrumentation/java-class-loader/tomcat-testing/tomcat-testing.gradle b/instrumentation/java-class-loader/tomcat-testing/tomcat-testing.gradle index 6b6f04878a..70030f437e 100644 --- a/instrumentation/java-class-loader/tomcat-testing/tomcat-testing.gradle +++ b/instrumentation/java-class-loader/tomcat-testing/tomcat-testing.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle b/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle index 6215ec04c0..d8ffa4b63b 100644 --- a/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle +++ b/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle @@ -3,8 +3,8 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" dependencies { compileOnly deps.scala diff --git a/instrumentation/java-concurrent/akka-testing/akka-testing.gradle b/instrumentation/java-concurrent/akka-testing/akka-testing.gradle index da0b61e9bf..cc8f5a9537 100644 --- a/instrumentation/java-concurrent/akka-testing/akka-testing.gradle +++ b/instrumentation/java-concurrent/akka-testing/akka-testing.gradle @@ -1,5 +1,5 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" dependencies { compileOnly deps.scala diff --git a/instrumentation/java-concurrent/java-concurrent.gradle b/instrumentation/java-concurrent/java-concurrent.gradle index afae81659f..b9a09dea24 100644 --- a/instrumentation/java-concurrent/java-concurrent.gradle +++ b/instrumentation/java-concurrent/java-concurrent.gradle @@ -1,5 +1,5 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" apply plugin: 'org.unbroken-dome.test-sets' // This won't work until the akka and scala integrations are split into separate projects. diff --git a/instrumentation/java-concurrent/kotlin-testing/kotlin-testing.gradle b/instrumentation/java-concurrent/kotlin-testing/kotlin-testing.gradle index 7ea2d73d21..b9795a675c 100644 --- a/instrumentation/java-concurrent/kotlin-testing/kotlin-testing.gradle +++ b/instrumentation/java-concurrent/kotlin-testing/kotlin-testing.gradle @@ -1,5 +1,5 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-kotlin.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-kotlin.gradle" dependencies { testCompile deps.kotlin diff --git a/instrumentation/java-concurrent/scala-testing/scala-testing.gradle b/instrumentation/java-concurrent/scala-testing/scala-testing.gradle index 79f2f6f69d..634c41f6de 100644 --- a/instrumentation/java-concurrent/scala-testing/scala-testing.gradle +++ b/instrumentation/java-concurrent/scala-testing/scala-testing.gradle @@ -1,5 +1,5 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" dependencies { compileOnly deps.scala diff --git a/instrumentation/java-util-logging/java-util-logging.gradle b/instrumentation/java-util-logging/java-util-logging.gradle index 3510b3cbfa..6e508b1952 100644 --- a/instrumentation/java-util-logging/java-util-logging.gradle +++ b/instrumentation/java-util-logging/java-util-logging.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/java-util-logging/src/main/java/io/opentelemetry/auto/instrumentation/jul/JavaUtilLoggingSpansInstrumentation.java b/instrumentation/java-util-logging/src/main/java/io/opentelemetry/auto/instrumentation/jul/JavaUtilLoggingSpansInstrumentation.java index 85acd6d740..99652d2d74 100644 --- a/instrumentation/java-util-logging/src/main/java/io/opentelemetry/auto/instrumentation/jul/JavaUtilLoggingSpansInstrumentation.java +++ b/instrumentation/java-util-logging/src/main/java/io/opentelemetry/auto/instrumentation/jul/JavaUtilLoggingSpansInstrumentation.java @@ -80,7 +80,7 @@ public class JavaUtilLoggingSpansInstrumentation extends Instrumenter.Default { @Advice.This final Logger logger, @Advice.Argument(0) final LogRecord logRecord) { // need to track call depth across all loggers in order to avoid double capture when one // logging framework delegates to another - final boolean topLevel = CallDepthThreadLocalMap.incrementCallDepth("logger") == 0; + final boolean topLevel = CallDepthThreadLocalMap.incrementCallDepth(Logger.class) == 0; if (topLevel) { JavaUtilLoggingSpans.capture(logger, logRecord); } @@ -90,7 +90,7 @@ public class JavaUtilLoggingSpansInstrumentation extends Instrumenter.Default { @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void methodExit(@Advice.Enter final boolean topLevel) { if (topLevel) { - CallDepthThreadLocalMap.reset("logger"); + CallDepthThreadLocalMap.reset(Logger.class); } } } diff --git a/instrumentation/jaxrs-client/jaxrs-client-1.1/jaxrs-client-1.1.gradle b/instrumentation/jaxrs-client/jaxrs-client-1.1/jaxrs-client-1.1.gradle index 2130f12ecf..edc9958fb4 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-1.1/jaxrs-client-1.1.gradle +++ b/instrumentation/jaxrs-client/jaxrs-client-1.1/jaxrs-client-1.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-jersey-2.0/jaxrs-client-2.0-jersey-2.0.gradle b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-jersey-2.0/jaxrs-client-2.0-jersey-2.0.gradle index 213473e93b..eaf7553235 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-jersey-2.0/jaxrs-client-2.0-jersey-2.0.gradle +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-jersey-2.0/jaxrs-client-2.0-jersey-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-2.0/jaxrs-client-2.0-resteasy-2.0.gradle b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-2.0/jaxrs-client-2.0-resteasy-2.0.gradle index dbca8157cf..6be2930967 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-2.0/jaxrs-client-2.0-resteasy-2.0.gradle +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-2.0/jaxrs-client-2.0-resteasy-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0.gradle b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0.gradle index 298c51d693..75a52606a4 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0.gradle +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jaxrs/jaxrs-1.0/jaxrs-1.0.gradle b/instrumentation/jaxrs/jaxrs-1.0/jaxrs-1.0.gradle index 09f7e6d650..d0ff4b7094 100644 --- a/instrumentation/jaxrs/jaxrs-1.0/jaxrs-1.0.gradle +++ b/instrumentation/jaxrs/jaxrs-1.0/jaxrs-1.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-jersey-2.0/jaxrs-2.0-jersey-2.0.gradle b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-jersey-2.0/jaxrs-2.0-jersey-2.0.gradle index a97efed8fd..25dc87606e 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-jersey-2.0/jaxrs-2.0-jersey-2.0.gradle +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-jersey-2.0/jaxrs-2.0-jersey-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { // Cant assert fails because muzzle assumes all instrumentations will fail diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.0/jaxrs-2.0-resteasy-3.0.gradle b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.0/jaxrs-2.0-resteasy-3.0.gradle index 6a35357adc..36ae52a07c 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.0/jaxrs-2.0-resteasy-3.0.gradle +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.0/jaxrs-2.0-resteasy-3.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { // Cant assert fails because muzzle assumes all instrumentations will fail diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.1/jaxrs-2.0-resteasy-3.1.gradle b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.1/jaxrs-2.0-resteasy-3.1.gradle index 1edf58ad52..306b2e2495 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.1/jaxrs-2.0-resteasy-3.1.gradle +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.1/jaxrs-2.0-resteasy-3.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { // Cant assert fails because muzzle assumes all instrumentations will fail diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0.gradle b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0.gradle index 74cc42506e..05a5dbf3a0 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0.gradle +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jdbc/jdbc.gradle b/instrumentation/jdbc/jdbc.gradle index 12775121b2..ad6b4d021d 100644 --- a/instrumentation/jdbc/jdbc.gradle +++ b/instrumentation/jdbc/jdbc.gradle @@ -2,7 +2,7 @@ plugins { id 'com.intershop.gradle.javacc' version '4.0.0' } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' diff --git a/instrumentation/jedis/jedis-1.4/jedis-1.4.gradle b/instrumentation/jedis/jedis-1.4/jedis-1.4.gradle index 97a25c5058..873d06bac0 100644 --- a/instrumentation/jedis/jedis-1.4/jedis-1.4.gradle +++ b/instrumentation/jedis/jedis-1.4/jedis-1.4.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jedis/jedis-3.0/jedis-3.0.gradle b/instrumentation/jedis/jedis-3.0/jedis-3.0.gradle index 4bd99914d9..ba055d1815 100644 --- a/instrumentation/jedis/jedis-3.0/jedis-3.0.gradle +++ b/instrumentation/jedis/jedis-3.0/jedis-3.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jetty-8.0/jetty-8.0.gradle b/instrumentation/jetty-8.0/jetty-8.0.gradle index 21d9e37d0b..356816622f 100644 --- a/instrumentation/jetty-8.0/jetty-8.0.gradle +++ b/instrumentation/jetty-8.0/jetty-8.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jms-1.1/jms-1.1.gradle b/instrumentation/jms-1.1/jms-1.1.gradle index 7b2c8463af..11f8c8a46a 100644 --- a/instrumentation/jms-1.1/jms-1.1.gradle +++ b/instrumentation/jms-1.1/jms-1.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/jsp-2.3/jsp-2.3.gradle b/instrumentation/jsp-2.3/jsp-2.3.gradle index 50afaef41d..35eba9f571 100644 --- a/instrumentation/jsp-2.3/jsp-2.3.gradle +++ b/instrumentation/jsp-2.3/jsp-2.3.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/kafka-clients-0.11/kafka-clients-0.11.gradle b/instrumentation/kafka-clients-0.11/kafka-clients-0.11.gradle index 9b1569a189..0fa1af6a7a 100644 --- a/instrumentation/kafka-clients-0.11/kafka-clients-0.11.gradle +++ b/instrumentation/kafka-clients-0.11/kafka-clients-0.11.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/kafka-streams-0.11/kafka-streams-0.11.gradle b/instrumentation/kafka-streams-0.11/kafka-streams-0.11.gradle index 10824a9c27..3ac9c23c94 100644 --- a/instrumentation/kafka-streams-0.11/kafka-streams-0.11.gradle +++ b/instrumentation/kafka-streams-0.11/kafka-streams-0.11.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/khttp-0.1/khttp-0.1.gradle b/instrumentation/khttp-0.1/khttp-0.1.gradle index 55e7267919..4f10f0f925 100644 --- a/instrumentation/khttp-0.1/khttp-0.1.gradle +++ b/instrumentation/khttp-0.1/khttp-0.1.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/lettuce/lettuce-4.0/lettuce-4.0.gradle b/instrumentation/lettuce/lettuce-4.0/lettuce-4.0.gradle index 1bc869d078..895e57bb9f 100644 --- a/instrumentation/lettuce/lettuce-4.0/lettuce-4.0.gradle +++ b/instrumentation/lettuce/lettuce-4.0/lettuce-4.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/lettuce/lettuce-5.0/lettuce-5.0.gradle b/instrumentation/lettuce/lettuce-5.0/lettuce-5.0.gradle index e294ab23d7..fc57e99022 100644 --- a/instrumentation/lettuce/lettuce-5.0/lettuce-5.0.gradle +++ b/instrumentation/lettuce/lettuce-5.0/lettuce-5.0.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/log4j/log4j-1.1/log4j-1.1.gradle b/instrumentation/log4j/log4j-1.1/log4j-1.1.gradle index d2e23dc9bd..0b2ab50cd6 100644 --- a/instrumentation/log4j/log4j-1.1/log4j-1.1.gradle +++ b/instrumentation/log4j/log4j-1.1/log4j-1.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/log4j/log4j-1.1/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v1_1/Log4jSpansInstrumentation.java b/instrumentation/log4j/log4j-1.1/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v1_1/Log4jSpansInstrumentation.java index 94d6bb881c..7eca7aecf2 100644 --- a/instrumentation/log4j/log4j-1.1/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v1_1/Log4jSpansInstrumentation.java +++ b/instrumentation/log4j/log4j-1.1/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v1_1/Log4jSpansInstrumentation.java @@ -75,7 +75,8 @@ public class Log4jSpansInstrumentation extends Instrumenter.Default { @Advice.Argument(3) final Throwable t) { // need to track call depth across all loggers to avoid double capture when one logging // framework delegates to another - final boolean topLevel = CallDepthThreadLocalMap.incrementCallDepth("logger") == 0; + final boolean topLevel = + CallDepthThreadLocalMap.incrementCallDepth(java.util.logging.Logger.class) == 0; if (topLevel) { Log4jSpans.capture(logger, level, message, t); } @@ -85,7 +86,7 @@ public class Log4jSpansInstrumentation extends Instrumenter.Default { @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void methodExit(@Advice.Enter final boolean topLevel) { if (topLevel) { - CallDepthThreadLocalMap.reset("logger"); + CallDepthThreadLocalMap.reset(java.util.logging.Logger.class); } } } diff --git a/instrumentation/log4j/log4j-2.0/log4j-2.0.gradle b/instrumentation/log4j/log4j-2.0/log4j-2.0.gradle index e221fa1501..1b5e8de744 100644 --- a/instrumentation/log4j/log4j-2.0/log4j-2.0.gradle +++ b/instrumentation/log4j/log4j-2.0/log4j-2.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/log4j/log4j-2.0/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v2_0/Log4jSpansInstrumentation.java b/instrumentation/log4j/log4j-2.0/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v2_0/Log4jSpansInstrumentation.java index c6b9f107c7..fb26f005c5 100644 --- a/instrumentation/log4j/log4j-2.0/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v2_0/Log4jSpansInstrumentation.java +++ b/instrumentation/log4j/log4j-2.0/src/main/java/io/opentelemetry/auto/instrumentation/log4j/v2_0/Log4jSpansInstrumentation.java @@ -92,7 +92,8 @@ public class Log4jSpansInstrumentation extends Instrumenter.Default { @Advice.Argument(4) final Throwable t) { // need to track call depth across all loggers in order to avoid double capture when one // logging framework delegates to another - final boolean topLevel = CallDepthThreadLocalMap.incrementCallDepth("logger") == 0; + final boolean topLevel = + CallDepthThreadLocalMap.incrementCallDepth(java.util.logging.Logger.class) == 0; if (topLevel) { Log4jSpans.capture(logger, level, message, t); } @@ -102,7 +103,7 @@ public class Log4jSpansInstrumentation extends Instrumenter.Default { @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void methodExit(@Advice.Enter final boolean topLevel) { if (topLevel) { - CallDepthThreadLocalMap.reset("logger"); + CallDepthThreadLocalMap.reset(java.util.logging.Logger.class); } } } @@ -117,7 +118,8 @@ public class Log4jSpansInstrumentation extends Instrumenter.Default { @Advice.Argument(5) final Throwable t) { // need to track call depth across all loggers in order to avoid double capture when one // logging framework delegates to another - final boolean topLevel = CallDepthThreadLocalMap.incrementCallDepth("logger") == 0; + final boolean topLevel = + CallDepthThreadLocalMap.incrementCallDepth(java.util.logging.Logger.class) == 0; if (topLevel) { Log4jSpans.capture(logger, level, message, t); } @@ -127,7 +129,7 @@ public class Log4jSpansInstrumentation extends Instrumenter.Default { @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void methodExit(@Advice.Enter final boolean topLevel) { if (topLevel) { - CallDepthThreadLocalMap.reset("logger"); + CallDepthThreadLocalMap.reset(java.util.logging.Logger.class); } } } diff --git a/instrumentation/logback-1.0/logback-1.0.gradle b/instrumentation/logback-1.0/logback-1.0.gradle index 1d3a8c12d7..d78c642723 100644 --- a/instrumentation/logback-1.0/logback-1.0.gradle +++ b/instrumentation/logback-1.0/logback-1.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" dependencies { compileOnly group: 'ch.qos.logback', name: 'logback-classic', version: '0.9.16' diff --git a/instrumentation/logback-1.0/src/main/java/io/opentelemetry/auto/instrumentation/logback/LogbackSpansInstrumentation.java b/instrumentation/logback-1.0/src/main/java/io/opentelemetry/auto/instrumentation/logback/LogbackSpansInstrumentation.java index 3c07e6a788..fc1e517318 100644 --- a/instrumentation/logback-1.0/src/main/java/io/opentelemetry/auto/instrumentation/logback/LogbackSpansInstrumentation.java +++ b/instrumentation/logback-1.0/src/main/java/io/opentelemetry/auto/instrumentation/logback/LogbackSpansInstrumentation.java @@ -67,7 +67,8 @@ public class LogbackSpansInstrumentation extends Instrumenter.Default { public static boolean methodEnter(@Advice.Argument(0) final ILoggingEvent event) { // need to track call depth across all loggers in order to avoid double capture when one // logging framework delegates to another - final boolean topLevel = CallDepthThreadLocalMap.incrementCallDepth("logger") == 0; + final boolean topLevel = + CallDepthThreadLocalMap.incrementCallDepth(java.util.logging.Logger.class) == 0; if (topLevel) { LogbackSpans.capture(event); } @@ -77,7 +78,7 @@ public class LogbackSpansInstrumentation extends Instrumenter.Default { @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void methodExit(@Advice.Enter final boolean topLevel) { if (topLevel) { - CallDepthThreadLocalMap.reset("logger"); + CallDepthThreadLocalMap.reset(java.util.logging.Logger.class); } } } diff --git a/instrumentation/mongo/mongo-3.1/mongo-3.1.gradle b/instrumentation/mongo/mongo-3.1/mongo-3.1.gradle index 263ab8ab63..d819fe5098 100644 --- a/instrumentation/mongo/mongo-3.1/mongo-3.1.gradle +++ b/instrumentation/mongo/mongo-3.1/mongo-3.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/mongo/mongo-3.7/mongo-3.7.gradle b/instrumentation/mongo/mongo-3.7/mongo-3.7.gradle index 3b2d349091..5a4929a87a 100644 --- a/instrumentation/mongo/mongo-3.7/mongo-3.7.gradle +++ b/instrumentation/mongo/mongo-3.7/mongo-3.7.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/mongo/mongo-async-3.3/mongo-async-3.3.gradle b/instrumentation/mongo/mongo-async-3.3/mongo-async-3.3.gradle index b91a8360a2..6002729d88 100644 --- a/instrumentation/mongo/mongo-async-3.3/mongo-async-3.3.gradle +++ b/instrumentation/mongo/mongo-async-3.3/mongo-async-3.3.gradle @@ -4,7 +4,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/mongo/mongo-common/mongo-common.gradle b/instrumentation/mongo/mongo-common/mongo-common.gradle index dd332d25fe..2cf45b7ed7 100644 --- a/instrumentation/mongo/mongo-common/mongo-common.gradle +++ b/instrumentation/mongo/mongo-common/mongo-common.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" dependencies { compileOnly group: 'org.mongodb', name: 'mongo-java-driver', version: '3.1.0' diff --git a/instrumentation/netty/netty-3.8/netty-3.8.gradle b/instrumentation/netty/netty-3.8/netty-3.8.gradle index 0989499084..01673e5cde 100644 --- a/instrumentation/netty/netty-3.8/netty-3.8.gradle +++ b/instrumentation/netty/netty-3.8/netty-3.8.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/netty/netty-4.0/netty-4.0.gradle b/instrumentation/netty/netty-4.0/netty-4.0.gradle index 189330b498..4df2b0a894 100644 --- a/instrumentation/netty/netty-4.0/netty-4.0.gradle +++ b/instrumentation/netty/netty-4.0/netty-4.0.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/netty/netty-4.1/netty-4.1.gradle b/instrumentation/netty/netty-4.1/netty-4.1.gradle index dc2941e294..b9e2064056 100644 --- a/instrumentation/netty/netty-4.1/netty-4.1.gradle +++ b/instrumentation/netty/netty-4.1/netty-4.1.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/okhttp/okhttp-2.2/okhttp-2.2.gradle b/instrumentation/okhttp/okhttp-2.2/okhttp-2.2.gradle index b1909af761..fa344d8773 100644 --- a/instrumentation/okhttp/okhttp-2.2/okhttp-2.2.gradle +++ b/instrumentation/okhttp/okhttp-2.2/okhttp-2.2.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' /* diff --git a/instrumentation/okhttp/okhttp-3.0/okhttp-3.0.gradle b/instrumentation/okhttp/okhttp-3.0/okhttp-3.0.gradle index 3f372aea35..38c079c9a2 100644 --- a/instrumentation/okhttp/okhttp-3.0/okhttp-3.0.gradle +++ b/instrumentation/okhttp/okhttp-3.0/okhttp-3.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/opentelemetry-api-0.4/opentelemetry-api-0.4.gradle b/instrumentation/opentelemetry-api-0.4/opentelemetry-api-0.4.gradle index 8938ddde22..7ab3b56eb1 100644 --- a/instrumentation/opentelemetry-api-0.4/opentelemetry-api-0.4.gradle +++ b/instrumentation/opentelemetry-api-0.4/opentelemetry-api-0.4.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" dependencies { // this instrumentation needs to be able to be able to reference both the OpenTelemetry API diff --git a/instrumentation/play-ws/play-ws-1.0/play-ws-1.0.gradle b/instrumentation/play-ws/play-ws-1.0/play-ws-1.0.gradle index e668a7f944..85e13fea7d 100644 --- a/instrumentation/play-ws/play-ws-1.0/play-ws-1.0.gradle +++ b/instrumentation/play-ws/play-ws-1.0/play-ws-1.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/play-ws/play-ws-2.0/play-ws-2.0.gradle b/instrumentation/play-ws/play-ws-2.0/play-ws-2.0.gradle index 3b5aa2a6dd..013e67ac57 100644 --- a/instrumentation/play-ws/play-ws-2.0/play-ws-2.0.gradle +++ b/instrumentation/play-ws/play-ws-2.0/play-ws-2.0.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/play-ws/play-ws-2.1/play-ws-2.1.gradle b/instrumentation/play-ws/play-ws-2.1/play-ws-2.1.gradle index 769817c3ef..bdab3a24d1 100644 --- a/instrumentation/play-ws/play-ws-2.1/play-ws-2.1.gradle +++ b/instrumentation/play-ws/play-ws-2.1/play-ws-2.1.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/play-ws/play-ws-common/play-ws-common.gradle b/instrumentation/play-ws/play-ws-common/play-ws-common.gradle index 2fca54fb3a..487b0ebb53 100644 --- a/instrumentation/play-ws/play-ws-common/play-ws-common.gradle +++ b/instrumentation/play-ws/play-ws-common/play-ws-common.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' def scalaVersion = '2.12' diff --git a/instrumentation/play/play-2.3/play-2.3.gradle b/instrumentation/play/play-2.3/play-2.3.gradle index 292087a416..70d777a9be 100644 --- a/instrumentation/play/play-2.3/play-2.3.gradle +++ b/instrumentation/play/play-2.3/play-2.3.gradle @@ -4,8 +4,8 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" -apply from: "${rootDir}/gradle/test-with-scala.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/test-with-scala.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/play/play-2.4/play-2.4.gradle b/instrumentation/play/play-2.4/play-2.4.gradle index a0d1f6c694..35a62a1460 100644 --- a/instrumentation/play/play-2.4/play-2.4.gradle +++ b/instrumentation/play/play-2.4/play-2.4.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/play/play-2.6/play-2.6.gradle b/instrumentation/play/play-2.6/play-2.6.gradle index 4a7f70a2f0..0ceb7e102b 100644 --- a/instrumentation/play/play-2.6/play-2.6.gradle +++ b/instrumentation/play/play-2.6/play-2.6.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' def scalaVersion = '2.11' diff --git a/instrumentation/rabbitmq-amqp-2.7/rabbitmq-amqp-2.7.gradle b/instrumentation/rabbitmq-amqp-2.7/rabbitmq-amqp-2.7.gradle index afb54ec034..c45f52af5c 100644 --- a/instrumentation/rabbitmq-amqp-2.7/rabbitmq-amqp-2.7.gradle +++ b/instrumentation/rabbitmq-amqp-2.7/rabbitmq-amqp-2.7.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/rabbitmq-amqp-2.7/src/main/java/io/opentelemetry/auto/instrumentation/rabbitmq/amqp/TracedDelegatingConsumer.java b/instrumentation/rabbitmq-amqp-2.7/src/main/java/io/opentelemetry/auto/instrumentation/rabbitmq/amqp/TracedDelegatingConsumer.java index 6f4b86a0ec..b313b3d767 100644 --- a/instrumentation/rabbitmq-amqp-2.7/src/main/java/io/opentelemetry/auto/instrumentation/rabbitmq/amqp/TracedDelegatingConsumer.java +++ b/instrumentation/rabbitmq-amqp-2.7/src/main/java/io/opentelemetry/auto/instrumentation/rabbitmq/amqp/TracedDelegatingConsumer.java @@ -21,6 +21,7 @@ import static io.opentelemetry.auto.instrumentation.rabbitmq.amqp.RabbitDecorato import static io.opentelemetry.auto.instrumentation.rabbitmq.amqp.TextMapExtractAdapter.GETTER; import static io.opentelemetry.trace.Span.Kind.CONSUMER; import static io.opentelemetry.trace.TracingContextUtils.currentContextWith; +import static java.util.concurrent.TimeUnit.NANOSECONDS; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Consumer; @@ -30,6 +31,7 @@ import io.opentelemetry.context.Scope; import io.opentelemetry.trace.Span; import java.io.IOException; import java.util.Map; +import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; /** @@ -90,14 +92,24 @@ public class TracedDelegatingConsumer implements Consumer { spanBuilder.setNoParent(); } + final long startTimeMillis = System.currentTimeMillis(); span = spanBuilder .setAttribute("message.size", body == null ? 0 : body.length) .setAttribute("span.origin.type", delegate.getClass().getName()) + .setStartTimestamp(TimeUnit.MILLISECONDS.toNanos(startTimeMillis)) .startSpan(); DECORATE.afterStart(span); DECORATE.onDeliver(span, envelope); + if (properties.getTimestamp() != null) { + // this will be set if the sender sets the timestamp, + // or if a plugin is installed on the rabbitmq broker + final long produceTime = properties.getTimestamp().getTime(); + final long consumeTime = NANOSECONDS.toMillis(startTimeMillis); + span.setAttribute("record.queue_time_ms", Math.max(0L, consumeTime - produceTime)); + } + scope = currentContextWith(span); } catch (final Exception e) { diff --git a/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy b/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy index 0a4c5a1ad9..f77f5fd449 100644 --- a/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy +++ b/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy @@ -107,9 +107,7 @@ class RabbitMQTest extends AgentTestRunner { channel.exchangeDeclare(exchangeName, "direct", false) String queueName = channel.queueDeclare().getQueue() channel.queueBind(queueName, exchangeName, routingKey) - channel.basicPublish(exchangeName, routingKey, null, "Hello, world!".getBytes()) - return channel.basicGet(queueName, true) } @@ -140,9 +138,7 @@ class RabbitMQTest extends AgentTestRunner { def "test rabbit publish/get default exchange"() { setup: String queueName = channel.queueDeclare().getQueue() - channel.basicPublish("", queueName, null, "Hello, world!".getBytes()) - GetResponse response = channel.basicGet(queueName, true) expect: @@ -182,7 +178,13 @@ class RabbitMQTest extends AgentTestRunner { channel.basicConsume(queueName, callback) (1..messageCount).each { - channel.basicPublish(exchangeName, "", null, "msg $it".getBytes()) + if (setTimestamp) { + channel.basicPublish(exchangeName, "", + new AMQP.BasicProperties.Builder().timestamp(new Date()).build(), + "msg $it".getBytes()) + } else { + channel.basicPublish(exchangeName, "", null, "msg $it".getBytes()) + } } def resource = messageCount % 2 == 0 ? "" : queueName @@ -203,7 +205,7 @@ class RabbitMQTest extends AgentTestRunner { (1..messageCount).each { trace(3 + it, 2) { rabbitSpan(it, 0, "$exchangeName -> ") - rabbitSpan(it, 1, resource, span(0)) + rabbitSpan(it, 1, resource, span(0), null, null, null, setTimestamp) } } } @@ -211,8 +213,15 @@ class RabbitMQTest extends AgentTestRunner { deliveries == (1..messageCount).collect { "msg $it" } where: - exchangeName = "some-exchange" - messageCount << (1..4) + exchangeName | messageCount | setTimestamp + "some-exchange" | 1 | false + "some-exchange" | 2 | false + "some-exchange" | 3 | false + "some-exchange" | 4 | false + "some-exchange" | 1 | true + "some-exchange" | 2 | true + "some-exchange" | 3 | true + "some-exchange" | 4 | true } def "test rabbit consume error"() { @@ -319,9 +328,10 @@ class RabbitMQTest extends AgentTestRunner { Object parentSpan = null, Object linkSpan = null, Throwable exception = null, - String errorMsg = null + String errorMsg = null, + Boolean expectTimestamp = false ) { - rabbitSpan(trace, 0, resource, parentSpan, linkSpan, exception, errorMsg) + rabbitSpan(trace, 0, resource, parentSpan, linkSpan, exception, errorMsg, expectTimestamp) } def rabbitSpan( @@ -331,7 +341,8 @@ class RabbitMQTest extends AgentTestRunner { Object parentSpan = null, Object linkSpan = null, Throwable exception = null, - String errorMsg = null + String errorMsg = null, + Boolean expectTimestamp = false ) { trace.span(index) { operationName resource @@ -366,6 +377,9 @@ class RabbitMQTest extends AgentTestRunner { "$MoreTags.NET_PEER_NAME" { it == null || it instanceof String } "$MoreTags.NET_PEER_IP" { "127.0.0.1" } "$MoreTags.NET_PEER_PORT" { it == null || it instanceof Long } + if (expectTimestamp) { + "record.queue_time_ms" { it instanceof Long && it >= 0 } + } switch (tag("amqp.command")?.stringValue) { case "basic.publish": diff --git a/instrumentation/ratpack-1.5/ratpack-1.5.gradle b/instrumentation/ratpack-1.5/ratpack-1.5.gradle index 1d0646ea4d..9738469e7f 100644 --- a/instrumentation/ratpack-1.5/ratpack-1.5.gradle +++ b/instrumentation/ratpack-1.5/ratpack-1.5.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/reactor-3.1/reactor-3.1.gradle b/instrumentation/reactor-3.1/reactor-3.1.gradle index 6c739d98a8..12d21e853e 100644 --- a/instrumentation/reactor-3.1/reactor-3.1.gradle +++ b/instrumentation/reactor-3.1/reactor-3.1.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/rediscala-1.8/rediscala-1.8.gradle b/instrumentation/rediscala-1.8/rediscala-1.8.gradle index 88dabcc1e5..8622dfd7a0 100644 --- a/instrumentation/rediscala-1.8/rediscala-1.8.gradle +++ b/instrumentation/rediscala-1.8/rediscala-1.8.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/rmi/rmi.gradle b/instrumentation/rmi/rmi.gradle index 37751e2927..ccb63ea2b2 100644 --- a/instrumentation/rmi/rmi.gradle +++ b/instrumentation/rmi/rmi.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/rxjava-1.0/rxjava-1.0.gradle b/instrumentation/rxjava-1.0/rxjava-1.0.gradle index 593b2425b4..6573f5d7dd 100644 --- a/instrumentation/rxjava-1.0/rxjava-1.0.gradle +++ b/instrumentation/rxjava-1.0/rxjava-1.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/servlet/glassfish-testing/glassfish-testing.gradle b/instrumentation/servlet/glassfish-testing/glassfish-testing.gradle index 0daf5c9b55..28f42af7ec 100644 --- a/instrumentation/servlet/glassfish-testing/glassfish-testing.gradle +++ b/instrumentation/servlet/glassfish-testing/glassfish-testing.gradle @@ -2,7 +2,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/instrumentation/servlet/request-2.3/request-2.3.gradle b/instrumentation/servlet/request-2.3/request-2.3.gradle index 5ffb4814b3..b30e802c3b 100644 --- a/instrumentation/servlet/request-2.3/request-2.3.gradle +++ b/instrumentation/servlet/request-2.3/request-2.3.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/servlet/request-3.0/request-3.0.gradle b/instrumentation/servlet/request-3.0/request-3.0.gradle index 5ae60d4f4e..ebb9abdcf9 100644 --- a/instrumentation/servlet/request-3.0/request-3.0.gradle +++ b/instrumentation/servlet/request-3.0/request-3.0.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/servlet/servlet-common/servlet-common.gradle b/instrumentation/servlet/servlet-common/servlet-common.gradle index 18518cc4d3..263dcdbf18 100644 --- a/instrumentation/servlet/servlet-common/servlet-common.gradle +++ b/instrumentation/servlet/servlet-common/servlet-common.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/servlet/servlet.gradle b/instrumentation/servlet/servlet.gradle index 6f0f6520b9..d55344c943 100644 --- a/instrumentation/servlet/servlet.gradle +++ b/instrumentation/servlet/servlet.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/slf4j-mdc/slf4j-mdc.gradle b/instrumentation/slf4j-mdc/slf4j-mdc.gradle index e1c55051cc..6175ed0b7f 100644 --- a/instrumentation/slf4j-mdc/slf4j-mdc.gradle +++ b/instrumentation/slf4j-mdc/slf4j-mdc.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" muzzle { pass { diff --git a/instrumentation/sparkjava-2.3/sparkjava-2.3.gradle b/instrumentation/sparkjava-2.3/sparkjava-2.3.gradle index 7b1fa2c262..38a8a2f617 100644 --- a/instrumentation/sparkjava-2.3/sparkjava-2.3.gradle +++ b/instrumentation/sparkjava-2.3/sparkjava-2.3.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' // building against 2.3 and testing against 2.4 because JettyHandler is available since 2.4 only diff --git a/instrumentation/spring-data-1.8/spring-data-1.8.gradle b/instrumentation/spring-data-1.8/spring-data-1.8.gradle index 1d9ddfff19..fa65ee0893 100644 --- a/instrumentation/spring-data-1.8/spring-data-1.8.gradle +++ b/instrumentation/spring-data-1.8/spring-data-1.8.gradle @@ -1,6 +1,6 @@ // This file includes software developed at SignalFx -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/spring-scheduling-3.1/spring-scheduling-3.1.gradle b/instrumentation/spring-scheduling-3.1/spring-scheduling-3.1.gradle index 808d8b6076..c862fa97ab 100644 --- a/instrumentation/spring-scheduling-3.1/spring-scheduling-3.1.gradle +++ b/instrumentation/spring-scheduling-3.1/spring-scheduling-3.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/spring-webflux-5.0/spring-webflux-5.0.gradle b/instrumentation/spring-webflux-5.0/spring-webflux-5.0.gradle index 3e1f3992e4..8e3077360e 100644 --- a/instrumentation/spring-webflux-5.0/spring-webflux-5.0.gradle +++ b/instrumentation/spring-webflux-5.0/spring-webflux-5.0.gradle @@ -4,7 +4,7 @@ ext { maxJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle b/instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle index 3dc88de1d4..7879e808da 100644 --- a/instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle +++ b/instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/spymemcached-2.12/spymemcached-2.12.gradle b/instrumentation/spymemcached-2.12/spymemcached-2.12.gradle index 3a1a5410d1..cafead812e 100644 --- a/instrumentation/spymemcached-2.12/spymemcached-2.12.gradle +++ b/instrumentation/spymemcached-2.12/spymemcached-2.12.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/trace-annotation/trace-annotation.gradle b/instrumentation/trace-annotation/trace-annotation.gradle index edac3b6566..61245a900b 100644 --- a/instrumentation/trace-annotation/trace-annotation.gradle +++ b/instrumentation/trace-annotation/trace-annotation.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" muzzle { pass { diff --git a/instrumentation/twilio-6.6/twilio-6.6.gradle b/instrumentation/twilio-6.6/twilio-6.6.gradle index 001c4e4b69..e8d8ccd54c 100644 --- a/instrumentation/twilio-6.6/twilio-6.6.gradle +++ b/instrumentation/twilio-6.6/twilio-6.6.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' muzzle { diff --git a/instrumentation/vertx-testing/vertx-testing.gradle b/instrumentation/vertx-testing/vertx-testing.gradle index bc18c09a17..a4c2f74721 100644 --- a/instrumentation/vertx-testing/vertx-testing.gradle +++ b/instrumentation/vertx-testing/vertx-testing.gradle @@ -3,7 +3,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 } -apply from: "${rootDir}/gradle/instrumentation.gradle" +apply from: "$rootDir/gradle/instrumentation.gradle" apply plugin: 'org.unbroken-dome.test-sets' testSets { diff --git a/java-agent/java-agent.gradle b/java-agent/java-agent.gradle index d3d6c49309..4909a406d3 100644 --- a/java-agent/java-agent.gradle +++ b/java-agent/java-agent.gradle @@ -6,9 +6,9 @@ plugins { description = 'opentelemetry-auto' -apply from: "${rootDir}/gradle/java.gradle" -apply from: "${rootDir}/gradle/version.gradle" -apply from: "${rootDir}/gradle/publish.gradle" +apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/gradle/version.gradle" +apply from: "$rootDir/gradle/publish.gradle" configurations { shadowInclude diff --git a/load-generator/load-generator.gradle b/load-generator/load-generator.gradle index d0e5e1cf56..93a21bf428 100644 --- a/load-generator/load-generator.gradle +++ b/load-generator/load-generator.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" dependencies { compile project(':auto-bootstrap') diff --git a/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle b/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle index f732954b83..0e268121e7 100644 --- a/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle +++ b/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle @@ -2,7 +2,7 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" dependencies { compile deps.opentelemetryApi diff --git a/opentelemetry-sdk-shaded-for-testing/opentelemetry-sdk-shaded-for-testing.gradle b/opentelemetry-sdk-shaded-for-testing/opentelemetry-sdk-shaded-for-testing.gradle index 91cf93e06c..4c72e58ce0 100644 --- a/opentelemetry-sdk-shaded-for-testing/opentelemetry-sdk-shaded-for-testing.gradle +++ b/opentelemetry-sdk-shaded-for-testing/opentelemetry-sdk-shaded-for-testing.gradle @@ -2,7 +2,7 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" dependencies { compile deps.opentelemetrySdk diff --git a/smoke-tests/cli/cli.gradle b/smoke-tests/cli/cli.gradle index b128452231..156956db4a 100644 --- a/smoke-tests/cli/cli.gradle +++ b/smoke-tests/cli/cli.gradle @@ -1,7 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" description = 'Command Line Application Smoke Tests.' jar { diff --git a/smoke-tests/java9-modules/java9-modules.gradle b/smoke-tests/java9-modules/java9-modules.gradle index cd983da74d..cf03822c2f 100644 --- a/smoke-tests/java9-modules/java9-modules.gradle +++ b/smoke-tests/java9-modules/java9-modules.gradle @@ -2,7 +2,7 @@ ext { minJavaVersionForTests = JavaVersion.VERSION_1_9 } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" jar { manifest { diff --git a/smoke-tests/play/play.gradle b/smoke-tests/play/play.gradle index 049d54dcea..4e9321752e 100644 --- a/smoke-tests/play/play.gradle +++ b/smoke-tests/play/play.gradle @@ -40,7 +40,7 @@ repositories { } } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" description = 'Play Integration Tests.' diff --git a/smoke-tests/smoke-tests.gradle b/smoke-tests/smoke-tests.gradle index 45020bf3c1..4c9ea3fc0b 100644 --- a/smoke-tests/smoke-tests.gradle +++ b/smoke-tests/smoke-tests.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" description = 'smoke-tests' diff --git a/smoke-tests/springboot/springboot.gradle b/smoke-tests/springboot/springboot.gradle index 7ab2a77ba4..6245021f06 100644 --- a/smoke-tests/springboot/springboot.gradle +++ b/smoke-tests/springboot/springboot.gradle @@ -1,7 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" description = 'SpringBoot Smoke Tests.' // The standard spring-boot plugin doesn't play nice with our project diff --git a/smoke-tests/wildfly/wildfly.gradle b/smoke-tests/wildfly/wildfly.gradle index b5e90294a6..822d78ebf7 100644 --- a/smoke-tests/wildfly/wildfly.gradle +++ b/smoke-tests/wildfly/wildfly.gradle @@ -19,7 +19,7 @@ repositories { } } -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" description = 'Wildfly Smoke Tests.' diff --git a/testing/testing.gradle b/testing/testing.gradle index 9bdff05800..4ae248d4e9 100644 --- a/testing/testing.gradle +++ b/testing/testing.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" minimumBranchCoverage = 0.5 minimumInstructionCoverage = 0.5 diff --git a/trace-java.gradle b/trace-java.gradle index a2f54293ac..e943ea4271 100644 --- a/trace-java.gradle +++ b/trace-java.gradle @@ -29,11 +29,11 @@ allprojects { group = 'io.opentelemetry.auto' if (isCI) { - buildDir = "${rootDir}/workspace/${projectDir.path.replace(rootDir.path, '')}/build/" + buildDir = "$rootDir/workspace/${projectDir.path.replace(rootDir.path, '')}/build/" } - apply from: "${rootDir}/gradle/dependencies.gradle" - apply from: "${rootDir}/gradle/util.gradle" + apply from: "$rootDir/gradle/dependencies.gradle" + apply from: "$rootDir/gradle/util.gradle" } repositories { diff --git a/utils/test-utils/test-utils.gradle b/utils/test-utils/test-utils.gradle index 68d1f4ebdc..8abd02c34f 100644 --- a/utils/test-utils/test-utils.gradle +++ b/utils/test-utils/test-utils.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" dependencies { compile deps.groovy diff --git a/utils/thread-utils/thread-utils.gradle b/utils/thread-utils/thread-utils.gradle index b0acd6b88e..ee3745cbba 100644 --- a/utils/thread-utils/thread-utils.gradle +++ b/utils/thread-utils/thread-utils.gradle @@ -1,4 +1,4 @@ -apply from: "${rootDir}/gradle/java.gradle" +apply from: "$rootDir/gradle/java.gradle" // TODO: add more tests excludedClassesCoverage += [