Merge pull request #481 from trask/dd-merge
This commit is contained in:
commit
5ce2f39124
|
@ -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
|
||||
|
|
|
@ -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<Map<Object, Integer>> TLS =
|
||||
new ThreadLocal<Map<Object, Integer>>() {
|
||||
|
||||
private static final ClassValue<ThreadLocalDepth> TLS =
|
||||
new ClassValue<ThreadLocalDepth>() {
|
||||
@Override
|
||||
public Map<Object, Integer> initialValue() {
|
||||
return new HashMap<>();
|
||||
protected ThreadLocalDepth computeValue(Class<?> type) {
|
||||
return new ThreadLocalDepth();
|
||||
}
|
||||
};
|
||||
|
||||
public static int incrementCallDepth(final Object k) {
|
||||
final Map<Object, Integer> 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<Depth> {
|
||||
@Override
|
||||
protected Depth initialValue() {
|
||||
return new Depth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -153,6 +153,7 @@ public class GlobalIgnoresMatcher<T extends TypeDescription>
|
|||
|| name.contains("javassist")
|
||||
|| name.contains(".asm.")
|
||||
|| name.contains("$__sisu")
|
||||
|| name.contains("$$EnhancerByProxool$$")
|
||||
|| name.startsWith("org.springframework.core.$Proxy")) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -11,7 +11,7 @@ byteBuddy {
|
|||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/gradle/java.gradle"
|
||||
apply from: "$rootDir/gradle/java.gradle"
|
||||
|
||||
tasks.withType(Test) {
|
||||
forkEvery = 1
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
testSets {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
//apply plugin: 'org.unbroken-dome.test-sets'
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -32,6 +32,7 @@ class Elasticsearch2SpringRepositoryTest extends AgentTestRunner {
|
|||
DocRepository repo = applicationContext.getBean(DocRepository)
|
||||
|
||||
def setup() {
|
||||
repo.refresh()
|
||||
TEST_WRITER.clear()
|
||||
runUnderTrace("delete") {
|
||||
repo.deleteAll()
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -33,6 +33,7 @@ class Elasticsearch2SpringRepositoryTest extends AgentTestRunner {
|
|||
DocRepository repo = applicationContext.getBean(DocRepository)
|
||||
|
||||
def setup() {
|
||||
repo.refresh()
|
||||
TEST_WRITER.clear()
|
||||
runUnderTrace("delete") {
|
||||
repo.deleteAll()
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -3,7 +3,7 @@ ext {
|
|||
minJavaVersionForTests = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -61,6 +61,7 @@ class Elasticsearch53SpringRepositoryTest extends AgentTestRunner {
|
|||
}
|
||||
|
||||
def setup() {
|
||||
repo.refresh()
|
||||
TEST_WRITER.clear()
|
||||
runUnderTrace("delete") {
|
||||
repo.deleteAll()
|
||||
|
|
|
@ -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<String> 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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1 +1 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
dependencies {
|
||||
testCompile project(':instrumentation:java-class-loader')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
dependencies {
|
||||
testCompile project(':instrumentation:java-class-loader')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apply from: "${rootDir}/gradle/instrumentation.gradle"
|
||||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
apply plugin: 'org.unbroken-dome.test-sets'
|
||||
|
||||
muzzle {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue