Inline basic usages of basicSpan (#3583)
* Inline basic usages of basicSpan * spock
This commit is contained in:
parent
050e675abc
commit
f5ce4c03f8
|
|
@ -7,8 +7,9 @@ package io.opentelemetry.instrumentation.apachedubbo.v2_7
|
|||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.api.trace.SpanKind.SERVER
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService
|
||||
import io.opentelemetry.instrumentation.apachedubbo.v2_7.impl.HelloServiceImpl
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
|
|
@ -87,7 +88,11 @@ abstract class AbstractDubboTest extends InstrumentationSpecification {
|
|||
response == "hello"
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "org.apache.dubbo.rpc.service.GenericService/\$invoke"
|
||||
kind CLIENT
|
||||
|
|
@ -154,7 +159,11 @@ abstract class AbstractDubboTest extends InstrumentationSpecification {
|
|||
responseAsync.get() == "hello"
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "org.apache.dubbo.rpc.service.GenericService/\$invokeAsync"
|
||||
kind CLIENT
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
|||
|
||||
import com.datastax.driver.core.Cluster
|
||||
import com.datastax.driver.core.Session
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
|
|
@ -104,7 +105,11 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
trace(keyspace ? 1 : 0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
cassandraSpan(it, 1, spanName, expectedStatement, operation, keyspace, table, span(0))
|
||||
basicSpan(it, 2, "callbackListener", span(0))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.datastax.oss.driver.api.core.CqlSession
|
|||
import com.datastax.oss.driver.api.core.config.DefaultDriverOption
|
||||
import com.datastax.oss.driver.api.core.config.DriverConfigLoader
|
||||
import com.datastax.oss.driver.internal.core.config.typesafe.DefaultDriverConfigLoader
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
|
|
@ -81,7 +82,11 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
cassandraSpan(it, 1, spanName, expectedStatement, operation, keyspace, table, span(0))
|
||||
basicSpan(it, 2, "child", span(0))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import com.couchbase.client.java.AsyncCluster
|
||||
import com.couchbase.client.java.CouchbaseAsyncCluster
|
||||
import com.couchbase.client.java.document.JsonDocument
|
||||
import com.couchbase.client.java.document.json.JsonObject
|
||||
import com.couchbase.client.java.env.CouchbaseEnvironment
|
||||
import com.couchbase.client.java.query.N1qlQuery
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import java.util.concurrent.TimeUnit
|
||||
import spock.lang.Unroll
|
||||
import spock.util.concurrent.BlockingVariable
|
||||
|
|
@ -69,7 +68,11 @@ abstract class AbstractCouchbaseAsyncClientTest extends AbstractCouchbaseTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
assertCouchbaseCall(it, 1, "Cluster.openBucket", null, span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.upsert", bucketSettings.name(), span(1))
|
||||
|
|
@ -114,7 +117,11 @@ abstract class AbstractCouchbaseAsyncClientTest extends AbstractCouchbaseTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
assertCouchbaseCall(it, 1, "Cluster.openBucket", null, span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.upsert", bucketSettings.name(), span(1))
|
||||
|
|
@ -159,7 +166,11 @@ abstract class AbstractCouchbaseAsyncClientTest extends AbstractCouchbaseTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
assertCouchbaseCall(it, 1, "Cluster.openBucket", null, span(0))
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import com.couchbase.client.java.Bucket
|
||||
import com.couchbase.client.java.Cluster
|
||||
import com.couchbase.client.java.CouchbaseCluster
|
||||
|
|
@ -12,6 +10,7 @@ import com.couchbase.client.java.document.JsonDocument
|
|||
import com.couchbase.client.java.document.json.JsonObject
|
||||
import com.couchbase.client.java.env.CouchbaseEnvironment
|
||||
import com.couchbase.client.java.query.N1qlQuery
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import spock.lang.Unroll
|
||||
import util.AbstractCouchbaseTest
|
||||
|
||||
|
|
@ -67,7 +66,11 @@ abstract class AbstractCouchbaseClientTest extends AbstractCouchbaseTest {
|
|||
assertCouchbaseCall(it, 0, "Cluster.openBucket")
|
||||
}
|
||||
trace(1, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", bucketSettings.name(), span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.get", bucketSettings.name(), span(0))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@
|
|||
|
||||
package springdata
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
|
||||
import com.couchbase.client.java.Cluster
|
||||
import com.couchbase.client.java.CouchbaseCluster
|
||||
import com.couchbase.client.java.env.CouchbaseEnvironment
|
||||
import com.couchbase.client.java.view.DefaultView
|
||||
import com.couchbase.client.java.view.DesignDocument
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import org.springframework.context.ConfigurableApplicationContext
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.data.repository.CrudRepository
|
||||
|
|
@ -123,7 +124,11 @@ abstract class AbstractCouchbaseSpringRepositoryTest extends AbstractCouchbaseTe
|
|||
result == doc
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", bucketCouchbase.name(), span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.get", bucketCouchbase.name(), span(0))
|
||||
}
|
||||
|
|
@ -150,7 +155,11 @@ abstract class AbstractCouchbaseSpringRepositoryTest extends AbstractCouchbaseTe
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", bucketCouchbase.name(), span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.upsert", bucketCouchbase.name(), span(0))
|
||||
}
|
||||
|
|
@ -178,7 +187,11 @@ abstract class AbstractCouchbaseSpringRepositoryTest extends AbstractCouchbaseTe
|
|||
assert !result
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
def dbName = bucketCouchbase.name()
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", dbName, span(0))
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@
|
|||
|
||||
package springdata
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
|
||||
import com.couchbase.client.java.Bucket
|
||||
import com.couchbase.client.java.Cluster
|
||||
import com.couchbase.client.java.CouchbaseCluster
|
||||
import com.couchbase.client.java.cluster.ClusterManager
|
||||
import com.couchbase.client.java.env.CouchbaseEnvironment
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import org.springframework.data.couchbase.core.CouchbaseTemplate
|
||||
import spock.lang.Retry
|
||||
import spock.lang.Shared
|
||||
|
|
@ -61,7 +62,7 @@ class AbstractCouchbaseSpringTemplateTest extends AbstractCouchbaseTest {
|
|||
memcacheEnvironment.shutdown()
|
||||
}
|
||||
|
||||
def "test write #name"() {
|
||||
def "test write #testName"() {
|
||||
setup:
|
||||
def doc = new Doc()
|
||||
def result
|
||||
|
|
@ -78,18 +79,22 @@ class AbstractCouchbaseSpringTemplateTest extends AbstractCouchbaseTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", name, span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.get", name, span(0))
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", testName, span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.get", testName, span(0))
|
||||
}
|
||||
}
|
||||
|
||||
where:
|
||||
template << templates
|
||||
name = template.couchbaseBucket.name()
|
||||
testName = template.couchbaseBucket.name()
|
||||
}
|
||||
|
||||
def "test remove #name"() {
|
||||
def "test remove #testName"() {
|
||||
setup:
|
||||
def doc = new Doc()
|
||||
|
||||
|
|
@ -103,9 +108,13 @@ class AbstractCouchbaseSpringTemplateTest extends AbstractCouchbaseTest {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "someTrace")
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", name, span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.remove", name, span(0))
|
||||
span(0) {
|
||||
name "someTrace"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
assertCouchbaseCall(it, 1, "Bucket.upsert", testName, span(0))
|
||||
assertCouchbaseCall(it, 2, "Bucket.remove", testName, span(0))
|
||||
}
|
||||
}
|
||||
clearExportedData()
|
||||
|
|
@ -117,12 +126,12 @@ class AbstractCouchbaseSpringTemplateTest extends AbstractCouchbaseTest {
|
|||
result == null
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
assertCouchbaseCall(it, 0, "Bucket.get", name)
|
||||
assertCouchbaseCall(it, 0, "Bucket.get", testName)
|
||||
}
|
||||
}
|
||||
|
||||
where:
|
||||
template << templates
|
||||
name = template.couchbaseBucket.name()
|
||||
testName = template.couchbaseBucket.name()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.dropwizard.views.View
|
||||
import io.dropwizard.views.freemarker.FreemarkerViewRenderer
|
||||
import io.dropwizard.views.mustache.MustacheViewRenderer
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
|
|
@ -26,7 +25,11 @@ class ViewRenderTest extends AgentInstrumentationSpecification {
|
|||
outputStream.toString().contains("This is an example of a view")
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "Render $template"
|
||||
childOf span(0)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import java.util.concurrent.ArrayBlockingQueue
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
|
@ -56,7 +57,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "supplier", span(0))
|
||||
basicSpan(it, 2, "appendingSupplier", span(0))
|
||||
basicSpan(it, 3, "function", span(0))
|
||||
|
|
@ -85,7 +90,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -109,7 +118,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +147,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +178,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +209,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -217,7 +242,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import java.util.concurrent.AbstractExecutorService
|
||||
|
|
@ -51,7 +52,7 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
@Shared
|
||||
def scheduleCallable = { e, c -> e.schedule((Callable) c, 10, TimeUnit.MILLISECONDS) }
|
||||
|
||||
def "#poolName '#name' propagates"() {
|
||||
def "#poolName '#testName' propagates"() {
|
||||
setup:
|
||||
def pool = poolImpl
|
||||
def m = method
|
||||
|
|
@ -75,7 +76,11 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -88,7 +93,7 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
|
||||
// Unfortunately, there's no simple way to test the cross product of methods/pools.
|
||||
where:
|
||||
name | method | poolImpl
|
||||
testName | method | poolImpl
|
||||
"execute Runnable" | executeRunnable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
"submit Runnable" | submitRunnable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
"submit Callable" | submitCallable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
|
|
@ -134,7 +139,7 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
poolName = poolImpl.class.simpleName
|
||||
}
|
||||
|
||||
def "#poolName '#name' wrap lambdas"() {
|
||||
def "#poolName '#testName' wrap lambdas"() {
|
||||
setup:
|
||||
ExecutorService pool = poolImpl
|
||||
def m = method
|
||||
|
|
@ -156,7 +161,11 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +175,7 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
pool.awaitTermination(10, TimeUnit.SECONDS)
|
||||
|
||||
where:
|
||||
name | method | wrap | poolImpl
|
||||
testName | method | wrap | poolImpl
|
||||
"execute Runnable" | executeRunnable | { LambdaGen.wrapRunnable(it) } | new ScheduledThreadPoolExecutor(1)
|
||||
"submit Runnable" | submitRunnable | { LambdaGen.wrapRunnable(it) } | new ScheduledThreadPoolExecutor(1)
|
||||
"submit Callable" | submitCallable | { LambdaGen.wrapCallable(it) } | new ScheduledThreadPoolExecutor(1)
|
||||
|
|
@ -175,7 +184,7 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
poolName = poolImpl.class.simpleName
|
||||
}
|
||||
|
||||
def "#poolName '#name' reports after canceled jobs"() {
|
||||
def "#poolName '#testName' reports after canceled jobs"() {
|
||||
setup:
|
||||
ExecutorService pool = poolImpl
|
||||
def m = method
|
||||
|
|
@ -224,7 +233,7 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
pool.awaitTermination(10, TimeUnit.SECONDS)
|
||||
|
||||
where:
|
||||
name | method | poolImpl
|
||||
testName | method | poolImpl
|
||||
"submit Runnable" | submitRunnable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
"submit Callable" | submitCallable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.instrumentation.grpc.v1_6
|
|||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.api.trace.SpanKind.SERVER
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
|
||||
import example.GreeterGrpc
|
||||
import example.Helloworld
|
||||
|
|
@ -35,6 +35,7 @@ import io.grpc.reflection.v1alpha.ServerReflectionGrpc
|
|||
import io.grpc.reflection.v1alpha.ServerReflectionRequest
|
||||
import io.grpc.reflection.v1alpha.ServerReflectionResponse
|
||||
import io.grpc.stub.StreamObserver
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
|
@ -84,7 +85,11 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "example.Greeter/SayHello"
|
||||
kind CLIENT
|
||||
|
|
@ -418,7 +423,11 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "example.Greeter/SayHello"
|
||||
kind CLIENT
|
||||
|
|
@ -528,7 +537,11 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "example.Greeter/SayHello"
|
||||
kind CLIENT
|
||||
|
|
@ -717,7 +730,11 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "example.Greeter/SayHello"
|
||||
kind CLIENT
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.instrumentation.jdbc.TestConnection
|
||||
import io.opentelemetry.instrumentation.jdbc.TestDriver
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.api.trace.SpanKind.INTERNAL
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource
|
||||
import com.zaxxer.hikari.HikariConfig
|
||||
import com.zaxxer.hikari.HikariDataSource
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.jdbc.TestConnection
|
||||
import io.opentelemetry.instrumentation.jdbc.TestDriver
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import java.sql.CallableStatement
|
||||
|
|
@ -176,7 +176,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
resultSet.getInt(1) == 3
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name spanName
|
||||
kind CLIENT
|
||||
|
|
@ -232,7 +236,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
resultSet.getInt(1) == 3
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name spanName
|
||||
kind CLIENT
|
||||
|
|
@ -280,7 +288,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
resultSet.getInt(1) == 3
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name spanName
|
||||
kind CLIENT
|
||||
|
|
@ -328,7 +340,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
resultSet.getInt(1) == 3
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name spanName
|
||||
kind CLIENT
|
||||
|
|
@ -376,7 +392,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
statement.updateCount == 0
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name dbNameLower
|
||||
kind CLIENT
|
||||
|
|
@ -425,7 +445,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name dbNameLower
|
||||
kind CLIENT
|
||||
|
|
@ -486,7 +510,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
rs.getInt(1) == 3
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name spanName
|
||||
kind CLIENT
|
||||
|
|
@ -538,7 +566,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, recursive ? 3 : 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
span(1) {
|
||||
name "${datasource.class.simpleName}.getConnection"
|
||||
|
|
@ -593,7 +625,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "DB Query"
|
||||
kind CLIENT
|
||||
|
|
@ -630,7 +666,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name spanName
|
||||
kind CLIENT
|
||||
|
|
@ -732,7 +772,11 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "SELECT table"
|
||||
kind CLIENT
|
||||
|
|
|
|||
|
|
@ -5,14 +5,18 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.jdbc
|
||||
|
||||
import io.opentelemetry.instrumentation.jdbc.internal.*
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.jdbc.internal.DbInfo
|
||||
import io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryCallableStatement
|
||||
import io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryConnection
|
||||
import io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryPreparedStatement
|
||||
import io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryStatement
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.LibraryTestTrait
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
class OpenTelemetryConnectionTest extends InstrumentationSpecification implements LibraryTestTrait {
|
||||
|
||||
def "verify create statement"() {
|
||||
|
|
@ -28,7 +32,11 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "SELECT my_name.users"
|
||||
kind CLIENT
|
||||
|
|
@ -76,7 +84,11 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "SELECT my_name.users"
|
||||
kind CLIENT
|
||||
|
|
@ -127,7 +139,11 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "SELECT my_name.users"
|
||||
kind CLIENT
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static org.junit.Assume.assumeTrue
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.javaagent.instrumentation.jetty.JavaLambdaMaker
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool
|
||||
|
|
@ -39,7 +40,11 @@ class QueuedThreadPoolTest extends AgentInstrumentationSpecification {
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +77,11 @@ class QueuedThreadPoolTest extends AgentInstrumentationSpecification {
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import static io.opentelemetry.api.trace.SpanKind.CONSUMER
|
|||
import static io.opentelemetry.api.trace.SpanKind.PRODUCER
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
|
@ -83,7 +84,11 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name SHARED_TOPIC + " send"
|
||||
kind PRODUCER
|
||||
|
|
@ -171,7 +176,11 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name SHARED_TOPIC + " send"
|
||||
kind PRODUCER
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import io.kubernetes.client.openapi.ApiCallback
|
|||
import io.kubernetes.client.openapi.ApiClient
|
||||
import io.kubernetes.client.openapi.ApiException
|
||||
import io.kubernetes.client.openapi.apis.CoreV1Api
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
|
@ -64,7 +65,11 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
|
||||
}
|
||||
}
|
||||
|
|
@ -117,7 +122,11 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
|
||||
basicSpan(it, 2, "callback", span(0))
|
||||
}
|
||||
|
|
@ -150,7 +159,11 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception.get())
|
||||
basicSpan(it, 2, "callback", span(0))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@
|
|||
package io.opentelemetry.instrumentation.mongo.testing
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
|
|
@ -86,7 +87,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "create", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"create\":\"$collectionName\",\"capped\":\"?\"}" ||
|
||||
it == "{\"create\": \"$collectionName\", \"capped\": \"?\", \"\$db\": \"?\", \"\$readPreference\": {\"mode\": \"?\"}}"
|
||||
|
|
@ -109,7 +114,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "create", collectionName, dbName, span(0), {
|
||||
assert it == "{\"create\":\"$collectionName\",\"capped\":\"?\"}" ||
|
||||
it == "{\"create\": \"$collectionName\", \"capped\": \"?\", \"\$db\": \"?\", \"\$readPreference\": {\"mode\": \"?\"}}"
|
||||
|
|
@ -132,7 +141,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "create", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"create\":\"$collectionName\",\"capped\":\"?\"}" ||
|
||||
it == "{\"create\": \"$collectionName\", \"capped\": \"?\", \"\$db\": \"?\", \"\$readPreference\": {\"mode\": \"?\"}}"
|
||||
|
|
@ -156,7 +169,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
count == 0
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "count", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"count\":\"$collectionName\",\"query\":{}}" ||
|
||||
it == "{\"count\":\"$collectionName\"}" ||
|
||||
|
|
@ -182,7 +199,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
count == 1
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "insert", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"insert\":\"$collectionName\",\"ordered\":\"?\",\"documents\":[{\"_id\":\"?\",\"password\":\"?\"}]}" ||
|
||||
it == "{\"insert\": \"$collectionName\", \"ordered\": \"?\", \"\$db\": \"?\", \"documents\": [{\"_id\": \"?\", \"password\": \"?\"}]}"
|
||||
|
|
@ -213,7 +234,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
modifiedCount == 1
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "update", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"update\":\"$collectionName\",\"ordered\":\"?\",\"updates\":[{\"q\":{\"password\":\"?\"},\"u\":{\"\$set\":{\"password\":\"?\"}}}]}" ||
|
||||
it == "{\"update\": \"?\", \"ordered\": \"?\", \"\$db\": \"?\", \"updates\": [{\"q\": {\"password\": \"?\"}, \"u\": {\"\$set\": {\"password\": \"?\"}}}]}"
|
||||
|
|
@ -244,7 +269,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
deletedCount == 1
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "delete", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"delete\":\"$collectionName\",\"ordered\":\"?\",\"deletes\":[{\"q\":{\"password\":\"?\"},\"limit\":\"?\"}]}" ||
|
||||
it == "{\"delete\": \"?\", \"ordered\": \"?\", \"\$db\": \"?\", \"deletes\": [{\"q\": {\"password\": \"?\"}, \"limit\": \"?\"}]}"
|
||||
|
|
@ -274,7 +303,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "find", collectionName, dbName, span(0)) {
|
||||
assert it == '{"find":"' + collectionName + '","filter":{"_id":{"$gte":"?"}},"batchSize":"?"}'
|
||||
true
|
||||
|
|
@ -314,7 +347,11 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
mongoSpan(it, 1, "create", collectionName, dbName, span(0)) {
|
||||
assert it == "{\"create\":\"$collectionName\",\"capped\":\"?\"}"
|
||||
true
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static org.junit.Assume.assumeTrue
|
||||
|
||||
import io.netty.bootstrap.Bootstrap
|
||||
|
|
@ -27,6 +26,7 @@ import io.netty.handler.codec.http.HttpVersion
|
|||
import io.netty.handler.ssl.SslContext
|
||||
import io.netty.handler.ssl.SslContextBuilder
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.base.HttpClientTest
|
||||
import io.opentelemetry.instrumentation.test.base.SingleConnection
|
||||
|
|
@ -173,7 +173,11 @@ class Netty41ClientTest extends HttpClientTest<DefaultFullHttpRequest> implement
|
|||
// the complex sequence of events
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent1")
|
||||
span(0) {
|
||||
name "parent1"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0))
|
||||
serverSpan(it, 2, span(1))
|
||||
}
|
||||
|
|
@ -188,12 +192,20 @@ class Netty41ClientTest extends HttpClientTest<DefaultFullHttpRequest> implement
|
|||
|
||||
assertTraces(2) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent1")
|
||||
span(0) {
|
||||
name "parent1"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0))
|
||||
serverSpan(it, 2, span(1))
|
||||
}
|
||||
trace(1, 3) {
|
||||
basicSpan(it, 0, "parent2")
|
||||
span(0) {
|
||||
name "parent2"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0))
|
||||
serverSpan(it, 2, span(1))
|
||||
}
|
||||
|
|
@ -290,7 +302,11 @@ class Netty41ClientTest extends HttpClientTest<DefaultFullHttpRequest> implement
|
|||
responseCode == 200
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
childOf span(0)
|
||||
name "tracedMethod"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternal
|
|||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.context.Context
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import java.time.Duration
|
||||
|
|
@ -52,7 +53,11 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, workSpans + 2) {
|
||||
basicSpan(it, 0, "trace-parent")
|
||||
span(0) {
|
||||
name "trace-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
|
||||
for (int i = 0; i < workSpans; i++) {
|
||||
|
|
@ -247,7 +252,11 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, (workItems * 2) + 3) {
|
||||
basicSpan(it, 0, "trace-parent")
|
||||
span(0) {
|
||||
name "trace-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
basicSpan(it, 2, "intermediate", span(1))
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,8 @@ package io.opentelemetry.instrumentation.reactor
|
|||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import reactor.core.publisher.Mono
|
||||
|
|
@ -37,7 +32,11 @@ abstract class AbstractSubscriptionTest extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "Connection.query", span(0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,11 @@ abstract class AbstractReactorNettyHttpClientTest extends HttpClientTest<HttpCli
|
|||
def parentSpan = span(0)
|
||||
def nettyClientSpan = span(1)
|
||||
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, parentSpan, "GET", resolveAddress("/success"))
|
||||
serverSpan(it, 2, nettyClientSpan)
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,11 @@ abstract class AbstractReactorNettyHttpClientTest extends HttpClientTest<HttpCli
|
|||
def parentSpan = span(0)
|
||||
def nettyClientSpan = span(1)
|
||||
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, parentSpan, "GET", resolveAddress("/success"))
|
||||
serverSpan(it, 2, nettyClientSpan)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
|||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.functions.Consumer
|
||||
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
abstract class AbstractRxJava2SubscriptionTest extends InstrumentationSpecification {
|
||||
|
|
@ -38,7 +38,11 @@ abstract class AbstractRxJava2SubscriptionTest extends InstrumentationSpecificat
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "Connection.query", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +68,11 @@ abstract class AbstractRxJava2SubscriptionTest extends InstrumentationSpecificat
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.rxjava2
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTraceWithoutExceptionCatch
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
|
||||
import com.google.common.collect.Lists
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.reactivex.BackpressureStrategy
|
||||
import io.reactivex.Completable
|
||||
|
|
@ -65,7 +65,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
def "Publisher '#name' test"() {
|
||||
def "Publisher '#testName' test"() {
|
||||
when:
|
||||
def result = assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
|
|
@ -76,7 +76,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
sortSpansByStartTime()
|
||||
trace(0, workSpans + 1) {
|
||||
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < workSpans + 1; ++i) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
}
|
||||
|
|
@ -84,7 +88,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | expected | workSpans | publisherSupplier
|
||||
testName | expected | workSpans | publisherSupplier
|
||||
"basic maybe" | 2 | 1 | { -> Maybe.just(1).map(addOne) }
|
||||
"two operations maybe" | 4 | 2 | { -> Maybe.just(2).map(addOne).map(addOne) }
|
||||
"delayed maybe" | 4 | 1 | { ->
|
||||
|
|
@ -118,7 +122,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
def "Publisher error '#name' test"() {
|
||||
def "Publisher error '#testName' test"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
|
|
@ -133,12 +137,16 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
// impact the spans on reactor integrations such as netty and lettuce, as reactor is
|
||||
// more of a context propagation mechanism than something we would be tracking for
|
||||
// errors this is ok.
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
where:
|
||||
name | publisherSupplier
|
||||
testName | publisherSupplier
|
||||
"maybe" | { -> Maybe.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
"flowable" | { -> Flowable.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
"single" | { -> Single.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
|
|
@ -146,7 +154,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
"completable" | { -> Completable.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
}
|
||||
|
||||
def "Publisher step '#name' test"() {
|
||||
def "Publisher step '#testName' test"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
|
|
@ -161,7 +169,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
// impact the spans on reactor integrations such as netty and lettuce, as reactor is
|
||||
// more of a context propagation mechanism than something we would be tracking for
|
||||
// errors this is ok.
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
|
|
@ -170,7 +182,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | workSpans | publisherSupplier
|
||||
testName | workSpans | publisherSupplier
|
||||
"basic maybe failure" | 1 | { ->
|
||||
Maybe.just(1).map(addOne).map({ throwException() })
|
||||
}
|
||||
|
|
@ -179,19 +191,23 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
def "Publisher '#name' cancel"() {
|
||||
def "Publisher '#testName' cancel"() {
|
||||
when:
|
||||
cancelUnderTrace(publisherSupplier)
|
||||
|
||||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
where:
|
||||
name | publisherSupplier
|
||||
testName | publisherSupplier
|
||||
"basic maybe" | { -> Maybe.just(1) }
|
||||
"basic flowable" | { -> Flowable.fromIterable([5, 6]) }
|
||||
"basic single" | { -> Single.just(1) }
|
||||
|
|
@ -199,14 +215,18 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
"basic observable" | { -> Observable.just(1) }
|
||||
}
|
||||
|
||||
def "Publisher chain spans have the correct parent for '#name'"() {
|
||||
def "Publisher chain spans have the correct parent for '#testName'"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, workSpans + 1) {
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
|
|
@ -215,7 +235,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | workSpans | publisherSupplier
|
||||
testName | workSpans | publisherSupplier
|
||||
"basic maybe" | 3 | { ->
|
||||
Maybe.just(1).map(addOne).map(addOne).concatWith(Maybe.just(1).map(addOne))
|
||||
}
|
||||
|
|
@ -238,14 +258,18 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
sortSpansByStartTime()
|
||||
basicSpan(it, 0, "trace-parent")
|
||||
span(0) {
|
||||
name "trace-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "addOne", span(0))
|
||||
basicSpan(it, 2, "addTwo", span(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def "Publisher chain spans have the correct parents from subscription time '#name'"() {
|
||||
def "Publisher chain spans have the correct parents from subscription time '#testName'"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace {
|
||||
// The "add one" operations in the publisher created here should be children of the publisher-parent
|
||||
|
|
@ -271,7 +295,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
assertTraces(1) {
|
||||
trace(0, 2 + 2 * workItems) {
|
||||
sortSpansByStartTime()
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "intermediate", span(0))
|
||||
|
||||
for (int i = 2; i < 2 + 2 * workItems; i = i + 2) {
|
||||
|
|
@ -282,7 +310,7 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | workItems | publisherSupplier
|
||||
testName | workItems | publisherSupplier
|
||||
"basic maybe" | 1 | { -> Maybe.just(1).map(addOne) }
|
||||
"basic flowable" | 2 | { -> Flowable.fromIterable([1, 2]).map(addOne) }
|
||||
"basic single" | 1 | { -> Single.just(1).map(addOne) }
|
||||
|
|
@ -307,7 +335,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
values.size() == 4
|
||||
assertTraces(1) {
|
||||
trace(0, 5) {
|
||||
basicSpan(it, 0, "flowable root")
|
||||
span(0) {
|
||||
name "flowable root"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < values.size() + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,13 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.rxjava3
|
||||
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.functions.Consumer
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.functions.Consumer
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
abstract class AbstractRxJava3SubscriptionTest extends InstrumentationSpecification {
|
||||
|
|
@ -37,7 +36,11 @@ abstract class AbstractRxJava3SubscriptionTest extends InstrumentationSpecificat
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "Connection.query", span(0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS
|
|||
|
||||
import com.google.common.collect.Lists
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.reactivex.rxjava3.core.BackpressureStrategy
|
||||
import io.reactivex.rxjava3.core.Completable
|
||||
|
|
@ -63,7 +64,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
def "Publisher '#name' test"() {
|
||||
def "Publisher '#testName' test"() {
|
||||
when:
|
||||
def result = assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
|
|
@ -74,7 +75,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
sortSpansByStartTime()
|
||||
trace(0, workSpans + 1) {
|
||||
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < workSpans + 1; ++i) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
}
|
||||
|
|
@ -82,7 +87,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | expected | workSpans | publisherSupplier
|
||||
testName | expected | workSpans | publisherSupplier
|
||||
"basic maybe" | 2 | 1 | { -> Maybe.just(1).map(addOne) }
|
||||
"two operations maybe" | 4 | 2 | { -> Maybe.just(2).map(addOne).map(addOne) }
|
||||
"delayed maybe" | 4 | 1 | { ->
|
||||
|
|
@ -116,7 +121,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
def "Publisher error '#name' test"() {
|
||||
def "Publisher error '#testName' test"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
|
|
@ -131,12 +136,16 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
// impact the spans on reactor integrations such as netty and lettuce, as reactor is
|
||||
// more of a context propagation mechanism than something we would be tracking for
|
||||
// errors this is ok.
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
where:
|
||||
name | publisherSupplier
|
||||
testName | publisherSupplier
|
||||
"maybe" | { -> Maybe.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
"flowable" | { -> Flowable.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
"single" | { -> Single.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
|
|
@ -144,7 +153,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
"completable" | { -> Completable.error(new RuntimeException(EXCEPTION_MESSAGE)) }
|
||||
}
|
||||
|
||||
def "Publisher step '#name' test"() {
|
||||
def "Publisher step '#testName' test"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
|
|
@ -159,7 +168,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
// impact the spans on reactor integrations such as netty and lettuce, as reactor is
|
||||
// more of a context propagation mechanism than something we would be tracking for
|
||||
// errors this is ok.
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
|
|
@ -168,7 +181,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | workSpans | publisherSupplier
|
||||
testName | workSpans | publisherSupplier
|
||||
"basic maybe failure" | 1 | { ->
|
||||
Maybe.just(1).map(addOne).map({ throwException() })
|
||||
}
|
||||
|
|
@ -177,19 +190,23 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
def "Publisher '#name' cancel"() {
|
||||
def "Publisher '#testName' cancel"() {
|
||||
when:
|
||||
cancelUnderTrace(publisherSupplier)
|
||||
|
||||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
where:
|
||||
name | publisherSupplier
|
||||
testName | publisherSupplier
|
||||
"basic maybe" | { -> Maybe.just(1) }
|
||||
"basic flowable" | { -> Flowable.fromIterable([5, 6]) }
|
||||
"basic single" | { -> Single.just(1) }
|
||||
|
|
@ -197,14 +214,18 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
"basic observable" | { -> Observable.just(1) }
|
||||
}
|
||||
|
||||
def "Publisher chain spans have the correct parent for '#name'"() {
|
||||
def "Publisher chain spans have the correct parent for '#testName'"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace(publisherSupplier)
|
||||
|
||||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, workSpans + 1) {
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
|
|
@ -213,7 +234,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | workSpans | publisherSupplier
|
||||
testName | workSpans | publisherSupplier
|
||||
"basic maybe" | 3 | { ->
|
||||
Maybe.just(1).map(addOne).map(addOne).concatWith(Maybe.just(1).map(addOne))
|
||||
}
|
||||
|
|
@ -236,14 +257,18 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
sortSpansByStartTime()
|
||||
basicSpan(it, 0, "trace-parent")
|
||||
span(0) {
|
||||
name "trace-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "addOne", span(0))
|
||||
basicSpan(it, 2, "addTwo", span(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def "Publisher chain spans have the correct parents from subscription time '#name'"() {
|
||||
def "Publisher chain spans have the correct parents from subscription time '#testName'"() {
|
||||
when:
|
||||
assemblePublisherUnderTrace {
|
||||
// The "add one" operations in the publisher created here should be children of the publisher-parent
|
||||
|
|
@ -269,7 +294,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
assertTraces(1) {
|
||||
trace(0, 2 + 2 * workItems) {
|
||||
sortSpansByStartTime()
|
||||
basicSpan(it, 0, "publisher-parent")
|
||||
span(0) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "intermediate", span(0))
|
||||
|
||||
for (int i = 2; i < 2 + 2 * workItems; i = i + 2) {
|
||||
|
|
@ -280,7 +309,7 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
where:
|
||||
name | workItems | publisherSupplier
|
||||
testName | workItems | publisherSupplier
|
||||
"basic maybe" | 1 | { -> Maybe.just(1).map(addOne) }
|
||||
"basic flowable" | 2 | { -> Flowable.fromIterable([1, 2]).map(addOne) }
|
||||
"basic single" | 1 | { -> Single.just(1).map(addOne) }
|
||||
|
|
@ -305,7 +334,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
values.size() == 4
|
||||
assertTraces(1) {
|
||||
trace(0, 5) {
|
||||
basicSpan(it, 0, "flowable root")
|
||||
span(0) {
|
||||
name "flowable root"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < values.size() + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import java.util.concurrent.ArrayBlockingQueue
|
||||
|
|
@ -37,7 +38,7 @@ class ScalaExecutorInstrumentationTest extends AgentInstrumentationSpecification
|
|||
@Shared
|
||||
def scalaInvokeForkJoinTask = { e, c -> e.invoke((ForkJoinTask) c) }
|
||||
|
||||
def "#poolImpl '#name' propagates"() {
|
||||
def "#poolImpl '#testName' propagates"() {
|
||||
setup:
|
||||
def pool = poolImpl
|
||||
def m = method
|
||||
|
|
@ -61,7 +62,11 @@ class ScalaExecutorInstrumentationTest extends AgentInstrumentationSpecification
|
|||
expect:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +76,7 @@ class ScalaExecutorInstrumentationTest extends AgentInstrumentationSpecification
|
|||
|
||||
// Unfortunately, there's no simple way to test the cross product of methods/pools.
|
||||
where:
|
||||
name | method | poolImpl
|
||||
testName | method | poolImpl
|
||||
"execute Runnable" | executeRunnable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
"submit Runnable" | submitRunnable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
"submit Callable" | submitCallable | new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1))
|
||||
|
|
@ -85,7 +90,7 @@ class ScalaExecutorInstrumentationTest extends AgentInstrumentationSpecification
|
|||
"invoke ForkJoinTask" | scalaInvokeForkJoinTask | new ForkJoinPool()
|
||||
}
|
||||
|
||||
def "#poolImpl '#name' reports after canceled jobs"() {
|
||||
def "#poolImpl '#testName' reports after canceled jobs"() {
|
||||
setup:
|
||||
ExecutorService pool = poolImpl
|
||||
def m = method
|
||||
|
|
@ -135,7 +140,7 @@ class ScalaExecutorInstrumentationTest extends AgentInstrumentationSpecification
|
|||
pool.awaitTermination(10, TimeUnit.SECONDS)
|
||||
|
||||
where:
|
||||
name | method | poolImpl
|
||||
testName | method | poolImpl
|
||||
"submit Runnable" | submitRunnable | new ForkJoinPool()
|
||||
"submit Callable" | submitCallable | new ForkJoinPool()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
|||
import static java.util.Collections.emptyEnumeration
|
||||
|
||||
import groovy.servlet.AbstractHttpServlet
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import javax.servlet.ServletOutputStream
|
||||
import javax.servlet.ServletRequest
|
||||
|
|
@ -56,7 +57,11 @@ class HttpServletResponseTest extends AgentInstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "TestResponse.sendError"
|
||||
childOf span(0)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.test.base
|
|||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
|
||||
// TODO: add a test for a longer chain of promises
|
||||
|
|
@ -42,7 +43,11 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
get(promise) == value
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "other", it.span(0))
|
||||
basicSpan(it, 2, "callback", it.span(0))
|
||||
}
|
||||
|
|
@ -73,11 +78,19 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
get(promise) == value
|
||||
assertTraces(2) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "callback", span(0))
|
||||
}
|
||||
trace(1, 1) {
|
||||
basicSpan(it, 0, "other")
|
||||
span(0) {
|
||||
name "other"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +118,11 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
get(promise) == value
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "callback", it.span(0))
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +151,11 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
// TODO: is this really the behavior we want?
|
||||
basicSpan(it, 0, "other")
|
||||
span(0) {
|
||||
name "other"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "callback", it.span(0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry
|
|||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import io.opentelemetry.api.trace.SpanBuilder
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.api.trace.Tracer
|
||||
import io.opentelemetry.context.Context
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
|
|
@ -349,7 +350,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
responseCode == 200
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0), method)
|
||||
serverSpan(it, 2, span(1))
|
||||
}
|
||||
|
|
@ -409,7 +414,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
// only one trace (client).
|
||||
assertTraces(1) {
|
||||
trace(0, 4) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0), method)
|
||||
serverSpan(it, 2, span(1))
|
||||
basicSpan(it, 3, "child", span(0))
|
||||
|
|
@ -440,7 +449,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
serverSpan(it, 1, span(0))
|
||||
}
|
||||
trace(1, 1) {
|
||||
basicSpan(it, 0, "callback")
|
||||
span(0) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -668,7 +681,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent")
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, uri, null, thrownException)
|
||||
basicSpan(it, 2, "callback", span(0))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue