Remove test dependency on GlobalTracer
This commit is contained in:
parent
d45b571996
commit
a9d3360701
|
@ -1,11 +1,12 @@
|
||||||
import datadog.trace.api.DDSpanTypes
|
import datadog.trace.api.DDSpanTypes
|
||||||
import io.opentracing.Scope
|
import datadog.trace.instrumentation.api.AgentScope
|
||||||
import io.opentracing.Tracer
|
|
||||||
import io.opentracing.tag.Tags
|
import io.opentracing.tag.Tags
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import org.hibernate.*
|
import org.hibernate.*
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activateSpan
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.startSpan
|
||||||
|
|
||||||
class SessionTest extends AbstractHibernateTest {
|
class SessionTest extends AbstractHibernateTest {
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -484,9 +485,7 @@ class SessionTest extends AbstractHibernateTest {
|
||||||
def "test hibernate overlapping Sessions"() {
|
def "test hibernate overlapping Sessions"() {
|
||||||
setup:
|
setup:
|
||||||
|
|
||||||
Tracer tracer = GlobalTracer.get()
|
AgentScope scope = activateSpan(startSpan("overlapping Sessions"), true)
|
||||||
|
|
||||||
Scope scope = tracer.buildSpan("overlapping Sessions").startActive(true)
|
|
||||||
|
|
||||||
def session1 = sessionFactory.openSession()
|
def session1 = sessionFactory.openSession()
|
||||||
session1.beginTransaction()
|
session1.beginTransaction()
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import datadog.trace.api.DDSpanTypes
|
import datadog.trace.api.DDSpanTypes
|
||||||
import io.opentracing.Scope
|
import datadog.trace.instrumentation.api.AgentScope
|
||||||
import io.opentracing.Tracer
|
|
||||||
import io.opentracing.tag.Tags
|
import io.opentracing.tag.Tags
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import org.hibernate.*
|
import org.hibernate.*
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activateSpan
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.startSpan
|
||||||
|
|
||||||
class SessionTest extends AbstractHibernateTest {
|
class SessionTest extends AbstractHibernateTest {
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -417,9 +418,7 @@ class SessionTest extends AbstractHibernateTest {
|
||||||
def "test hibernate overlapping Sessions"() {
|
def "test hibernate overlapping Sessions"() {
|
||||||
setup:
|
setup:
|
||||||
|
|
||||||
Tracer tracer = GlobalTracer.get()
|
AgentScope scope = activateSpan(startSpan("overlapping Sessions"), true)
|
||||||
|
|
||||||
Scope scope = tracer.buildSpan("overlapping Sessions").startActive(true)
|
|
||||||
|
|
||||||
def session1 = sessionFactory.openSession()
|
def session1 = sessionFactory.openSession()
|
||||||
session1.beginTransaction()
|
session1.beginTransaction()
|
||||||
|
|
|
@ -3,13 +3,13 @@ import datadog.trace.api.Config
|
||||||
import datadog.trace.api.DDSpanTypes
|
import datadog.trace.api.DDSpanTypes
|
||||||
import datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionDecorator
|
import datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionDecorator
|
||||||
import io.opentracing.tag.Tags
|
import io.opentracing.tag.Tags
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import spock.lang.Ignore
|
import spock.lang.Ignore
|
||||||
import spock.lang.Requires
|
import spock.lang.Requires
|
||||||
import sun.net.www.protocol.https.HttpsURLConnectionImpl
|
import sun.net.www.protocol.https.HttpsURLConnectionImpl
|
||||||
|
|
||||||
import static datadog.trace.agent.test.utils.ConfigUtils.withConfigOverride
|
import static datadog.trace.agent.test.utils.ConfigUtils.withConfigOverride
|
||||||
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
|
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
import static datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionInstrumentation.HttpUrlState.OPERATION_NAME
|
import static datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionInstrumentation.HttpUrlState.OPERATION_NAME
|
||||||
|
|
||||||
class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
|
@ -25,9 +25,9 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
headers.each { connection.setRequestProperty(it.key, it.value) }
|
headers.each { connection.setRequestProperty(it.key, it.value) }
|
||||||
connection.setRequestProperty("Connection", "close")
|
connection.setRequestProperty("Connection", "close")
|
||||||
connection.useCaches = true
|
connection.useCaches = true
|
||||||
def parentSpan = GlobalTracer.get().scopeManager().active()
|
def parentSpan = activeScope()
|
||||||
def stream = connection.inputStream
|
def stream = connection.inputStream
|
||||||
assert GlobalTracer.get().scopeManager().active() == parentSpan
|
assert activeScope() == parentSpan
|
||||||
stream.readLines()
|
stream.readLines()
|
||||||
stream.close()
|
stream.close()
|
||||||
callback?.call()
|
callback?.call()
|
||||||
|
@ -55,7 +55,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
runUnderTrace("someTrace") {
|
runUnderTrace("someTrace") {
|
||||||
HttpURLConnection connection = url.openConnection()
|
HttpURLConnection connection = url.openConnection()
|
||||||
connection.useCaches = useCaches
|
connection.useCaches = useCaches
|
||||||
assert GlobalTracer.get().scopeManager().active() != null
|
assert activeScope() != null
|
||||||
def stream = connection.inputStream
|
def stream = connection.inputStream
|
||||||
def lines = stream.readLines()
|
def lines = stream.readLines()
|
||||||
stream.close()
|
stream.close()
|
||||||
|
@ -65,7 +65,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
// call again to ensure the cycling is ok
|
// call again to ensure the cycling is ok
|
||||||
connection = url.openConnection()
|
connection = url.openConnection()
|
||||||
connection.useCaches = useCaches
|
connection.useCaches = useCaches
|
||||||
assert GlobalTracer.get().scopeManager().active() != null
|
assert activeScope() != null
|
||||||
assert connection.getResponseCode() == STATUS // call before input stream to test alternate behavior
|
assert connection.getResponseCode() == STATUS // call before input stream to test alternate behavior
|
||||||
connection.inputStream
|
connection.inputStream
|
||||||
stream = connection.inputStream // one more to ensure state is working
|
stream = connection.inputStream // one more to ensure state is working
|
||||||
|
@ -141,7 +141,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
HttpURLConnection connection = url.openConnection()
|
HttpURLConnection connection = url.openConnection()
|
||||||
connection.useCaches = useCaches
|
connection.useCaches = useCaches
|
||||||
connection.addRequestProperty("is-dd-server", "false")
|
connection.addRequestProperty("is-dd-server", "false")
|
||||||
assert GlobalTracer.get().scopeManager().active() != null
|
assert activeScope() != null
|
||||||
def stream = connection.inputStream
|
def stream = connection.inputStream
|
||||||
connection.inputStream // one more to ensure state is working
|
connection.inputStream // one more to ensure state is working
|
||||||
def lines = stream.readLines()
|
def lines = stream.readLines()
|
||||||
|
@ -153,7 +153,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
connection = url.openConnection()
|
connection = url.openConnection()
|
||||||
connection.useCaches = useCaches
|
connection.useCaches = useCaches
|
||||||
connection.addRequestProperty("is-dd-server", "false")
|
connection.addRequestProperty("is-dd-server", "false")
|
||||||
assert GlobalTracer.get().scopeManager().active() != null
|
assert activeScope() != null
|
||||||
assert connection.getResponseCode() == STATUS // call before input stream to test alternate behavior
|
assert connection.getResponseCode() == STATUS // call before input stream to test alternate behavior
|
||||||
stream = connection.inputStream
|
stream = connection.inputStream
|
||||||
lines = stream.readLines()
|
lines = stream.readLines()
|
||||||
|
@ -226,7 +226,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
HttpURLConnection connection = url.openConnection()
|
HttpURLConnection connection = url.openConnection()
|
||||||
connection.setRequestProperty("Connection", "close")
|
connection.setRequestProperty("Connection", "close")
|
||||||
connection.addRequestProperty("is-dd-server", "false")
|
connection.addRequestProperty("is-dd-server", "false")
|
||||||
assert GlobalTracer.get().scopeManager().active() != null
|
assert activeScope() != null
|
||||||
assert connection.getResponseCode() == STATUS
|
assert connection.getResponseCode() == STATUS
|
||||||
return connection
|
return connection
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import datadog.trace.agent.test.base.HttpClientTest
|
import datadog.trace.agent.test.base.HttpClientTest
|
||||||
import datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionDecorator
|
import datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionDecorator
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
|
|
||||||
class HttpUrlConnectionUseCachesFalseTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
class HttpUrlConnectionUseCachesFalseTest extends HttpClientTest<HttpUrlConnectionDecorator> {
|
||||||
|
|
||||||
|
@ -12,9 +13,9 @@ class HttpUrlConnectionUseCachesFalseTest extends HttpClientTest<HttpUrlConnecti
|
||||||
headers.each { connection.setRequestProperty(it.key, it.value) }
|
headers.each { connection.setRequestProperty(it.key, it.value) }
|
||||||
connection.setRequestProperty("Connection", "close")
|
connection.setRequestProperty("Connection", "close")
|
||||||
connection.useCaches = false
|
connection.useCaches = false
|
||||||
def parentSpan = GlobalTracer.get().scopeManager().active()
|
def parentSpan = activeScope()
|
||||||
def stream = connection.inputStream
|
def stream = connection.inputStream
|
||||||
assert GlobalTracer.get().scopeManager().active() == parentSpan
|
assert activeScope() == parentSpan
|
||||||
stream.readLines()
|
stream.readLines()
|
||||||
stream.close()
|
stream.close()
|
||||||
callback?.call()
|
callback?.call()
|
||||||
|
|
|
@ -4,11 +4,11 @@ import datadog.trace.api.DDSpanTypes
|
||||||
import datadog.trace.bootstrap.DatadogClassLoader
|
import datadog.trace.bootstrap.DatadogClassLoader
|
||||||
import datadog.trace.instrumentation.http_url_connection.UrlInstrumentation
|
import datadog.trace.instrumentation.http_url_connection.UrlInstrumentation
|
||||||
import io.opentracing.tag.Tags
|
import io.opentracing.tag.Tags
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
|
|
||||||
import static datadog.trace.agent.test.utils.ConfigUtils.withConfigOverride
|
import static datadog.trace.agent.test.utils.ConfigUtils.withConfigOverride
|
||||||
import static datadog.trace.agent.test.utils.PortUtils.UNUSABLE_PORT
|
import static datadog.trace.agent.test.utils.PortUtils.UNUSABLE_PORT
|
||||||
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
|
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
import static datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionInstrumentation.HttpUrlState.OPERATION_NAME
|
import static datadog.trace.instrumentation.http_url_connection.HttpUrlConnectionInstrumentation.HttpUrlState.OPERATION_NAME
|
||||||
|
|
||||||
class UrlConnectionTest extends AgentTestRunner {
|
class UrlConnectionTest extends AgentTestRunner {
|
||||||
|
@ -20,7 +20,7 @@ class UrlConnectionTest extends AgentTestRunner {
|
||||||
URLConnection connection = url.openConnection()
|
URLConnection connection = url.openConnection()
|
||||||
connection.setConnectTimeout(10000)
|
connection.setConnectTimeout(10000)
|
||||||
connection.setReadTimeout(10000)
|
connection.setReadTimeout(10000)
|
||||||
assert GlobalTracer.get().scopeManager().active() != null
|
assert activeScope() != null
|
||||||
connection.inputStream
|
connection.inputStream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import akka.dispatch.forkjoin.ForkJoinPool
|
import akka.dispatch.forkjoin.ForkJoinPool
|
||||||
import akka.dispatch.forkjoin.ForkJoinTask
|
import akka.dispatch.forkjoin.ForkJoinTask
|
||||||
import datadog.opentracing.DDSpan
|
import datadog.opentracing.DDSpan
|
||||||
import datadog.opentracing.scopemanager.ContinuableScope
|
|
||||||
import datadog.trace.agent.test.AgentTestRunner
|
import datadog.trace.agent.test.AgentTestRunner
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
|
@ -15,6 +13,8 @@ import java.util.concurrent.RejectedExecutionException
|
||||||
import java.util.concurrent.ThreadPoolExecutor
|
import java.util.concurrent.ThreadPoolExecutor
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test executor instrumentation for Akka specific classes.
|
* Test executor instrumentation for Akka specific classes.
|
||||||
* This is to large extent a copy of ExecutorInstrumentationTest.
|
* This is to large extent a copy of ExecutorInstrumentationTest.
|
||||||
|
@ -43,7 +43,7 @@ class AkkaExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
// this child will have a span
|
// this child will have a span
|
||||||
m(pool, new AkkaAsyncChild())
|
m(pool, new AkkaAsyncChild())
|
||||||
// this child won't
|
// this child won't
|
||||||
|
@ -91,7 +91,7 @@ class AkkaExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 20; ++i) {
|
for (int i = 0; i < 20; ++i) {
|
||||||
// Our current instrumentation instrumentation does not behave very well
|
// Our current instrumentation instrumentation does not behave very well
|
||||||
|
|
|
@ -2,8 +2,7 @@ import akka.actor.{Actor, ActorLogging, ActorRef, ActorSystem, Props}
|
||||||
import akka.pattern.ask
|
import akka.pattern.ask
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import datadog.trace.context.TraceScope
|
import datadog.trace.instrumentation.api.AgentTracer.{activeScope, activeSpan}
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
|
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ object AkkaActors {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def tracedChild(opName: String): Unit = {
|
def tracedChild(opName: String): Unit = {
|
||||||
GlobalTracer.get().activeSpan().setOperationName(opName)
|
activeSpan().setSpanName(opName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,21 +33,21 @@ class AkkaActors {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def basicTell(): Unit = {
|
def basicTell(): Unit = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
howdyGreeter ! WhoToGreet("Akka")
|
howdyGreeter ! WhoToGreet("Akka")
|
||||||
howdyGreeter ! Greet
|
howdyGreeter ! Greet
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def basicAsk(): Unit = {
|
def basicAsk(): Unit = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
howdyGreeter ! WhoToGreet("Akka")
|
howdyGreeter ! WhoToGreet("Akka")
|
||||||
howdyGreeter ? Greet
|
howdyGreeter ? Greet
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def basicForward(): Unit = {
|
def basicForward(): Unit = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
helloGreeter ! WhoToGreet("Akka")
|
helloGreeter ! WhoToGreet("Akka")
|
||||||
helloGreeter ? Greet
|
helloGreeter ? Greet
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import datadog.trace.context.TraceScope
|
import datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
import io.opentracing.Scope
|
import datadog.trace.instrumentation.api.AgentTracer.activeSpan
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.channels.*
|
import kotlinx.coroutines.channels.*
|
||||||
import kotlinx.coroutines.selects.select
|
import kotlinx.coroutines.selects.select
|
||||||
|
@ -126,15 +125,12 @@ class KotlinCoroutineTests(private val dispatcher: CoroutineDispatcher) {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
fun tracedChild(opName: String){
|
fun tracedChild(opName: String){
|
||||||
GlobalTracer.get().activeSpan().setOperationName(opName)
|
activeSpan().setSpanName(opName)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T> runTest(asyncPropagation: Boolean = true, block: suspend CoroutineScope.()->T ): T {
|
private fun <T> runTest(asyncPropagation: Boolean = true, block: suspend CoroutineScope.()->T ): T {
|
||||||
GlobalTracer.get().scopeManager().active().setAsyncPropagation(asyncPropagation)
|
activeScope().setAsyncPropagation(asyncPropagation)
|
||||||
return runBlocking(dispatcher,block = block)
|
return runBlocking(dispatcher,block = block)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Scope.setAsyncPropagation(value: Boolean): Unit =
|
|
||||||
(this as TraceScope).setAsyncPropagation(value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import datadog.opentracing.DDSpan
|
import datadog.opentracing.DDSpan
|
||||||
import datadog.opentracing.scopemanager.ContinuableScope
|
|
||||||
import datadog.trace.agent.test.AgentTestRunner
|
import datadog.trace.agent.test.AgentTestRunner
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import scala.concurrent.forkjoin.ForkJoinPool
|
import scala.concurrent.forkjoin.ForkJoinPool
|
||||||
import scala.concurrent.forkjoin.ForkJoinTask
|
import scala.concurrent.forkjoin.ForkJoinTask
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
@ -15,6 +13,8 @@ import java.util.concurrent.RejectedExecutionException
|
||||||
import java.util.concurrent.ThreadPoolExecutor
|
import java.util.concurrent.ThreadPoolExecutor
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test executor instrumentation for Scala specific classes.
|
* Test executor instrumentation for Scala specific classes.
|
||||||
* This is to large extent a copy of ExecutorInstrumentationTest.
|
* This is to large extent a copy of ExecutorInstrumentationTest.
|
||||||
|
@ -43,7 +43,7 @@ class ScalaExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
// this child will have a span
|
// this child will have a span
|
||||||
m(pool, new ScalaAsyncChild())
|
m(pool, new ScalaAsyncChild())
|
||||||
// this child won't
|
// this child won't
|
||||||
|
@ -91,7 +91,7 @@ class ScalaExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 20; ++i) {
|
for (int i = 0; i < 20; ++i) {
|
||||||
// Our current instrumentation instrumentation does not behave very well
|
// Our current instrumentation instrumentation does not behave very well
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import datadog.trace.context.TraceScope
|
import datadog.trace.instrumentation.api.AgentTracer.{activeScope, activeSpan}
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
|
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
import scala.concurrent.ExecutionContext.Implicits.global
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
@ -13,7 +12,7 @@ class ScalaConcurrentTests {
|
||||||
*/
|
*/
|
||||||
@Trace
|
@Trace
|
||||||
def traceWithFutureAndCallbacks(): Integer = {
|
def traceWithFutureAndCallbacks(): Integer = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
val goodFuture: Future[Integer] = Future {
|
val goodFuture: Future[Integer] = Future {
|
||||||
tracedChild("goodFuture")
|
tracedChild("goodFuture")
|
||||||
1
|
1
|
||||||
|
@ -34,7 +33,7 @@ class ScalaConcurrentTests {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def tracedAcrossThreadsWithNoTrace(): Integer = {
|
def tracedAcrossThreadsWithNoTrace(): Integer = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
val goodFuture: Future[Integer] = Future {
|
val goodFuture: Future[Integer] = Future {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
@ -54,7 +53,7 @@ class ScalaConcurrentTests {
|
||||||
*/
|
*/
|
||||||
@Trace
|
@Trace
|
||||||
def traceWithPromises(): Integer = {
|
def traceWithPromises(): Integer = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
val keptPromise = Promise[Boolean]()
|
val keptPromise = Promise[Boolean]()
|
||||||
val brokenPromise = Promise[Boolean]()
|
val brokenPromise = Promise[Boolean]()
|
||||||
val afterPromise = keptPromise.future
|
val afterPromise = keptPromise.future
|
||||||
|
@ -87,7 +86,7 @@ class ScalaConcurrentTests {
|
||||||
*/
|
*/
|
||||||
@Trace
|
@Trace
|
||||||
def tracedWithFutureFirstCompletions(): Integer = {
|
def tracedWithFutureFirstCompletions(): Integer = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
val completedVal = Future.firstCompletedOf(
|
val completedVal = Future.firstCompletedOf(
|
||||||
List(
|
List(
|
||||||
Future {
|
Future {
|
||||||
|
@ -111,7 +110,7 @@ class ScalaConcurrentTests {
|
||||||
*/
|
*/
|
||||||
@Trace
|
@Trace
|
||||||
def tracedTimeout(): Integer = {
|
def tracedTimeout(): Integer = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
val f: Future[String] = Future {
|
val f: Future[String] = Future {
|
||||||
tracedChild("timeoutChild")
|
tracedChild("timeoutChild")
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -130,6 +129,6 @@ class ScalaConcurrentTests {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def tracedChild(opName: String): Unit = {
|
def tracedChild(opName: String): Unit = {
|
||||||
GlobalTracer.get().activeSpan().setOperationName(opName)
|
activeSpan().setSpanName(opName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import datadog.opentracing.DDSpan
|
import datadog.opentracing.DDSpan
|
||||||
import datadog.opentracing.scopemanager.ContinuableScope
|
|
||||||
import datadog.trace.agent.test.AgentTestRunner
|
import datadog.trace.agent.test.AgentTestRunner
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
|
|
||||||
import java.util.concurrent.ArrayBlockingQueue
|
import java.util.concurrent.ArrayBlockingQueue
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
|
@ -11,6 +9,8 @@ import java.util.concurrent.TimeUnit
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import java.util.function.Supplier
|
import java.util.function.Supplier
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: ideally this should live with the rest of ExecutorInstrumentationTest,
|
* Note: ideally this should live with the rest of ExecutorInstrumentationTest,
|
||||||
* but this code needs java8 so we put it here for now.
|
* but this code needs java8 so we put it here for now.
|
||||||
|
@ -42,7 +42,7 @@ class CompletableFutureTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
CompletableFuture<String> get() {
|
CompletableFuture<String> get() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
return CompletableFuture.supplyAsync(supplier, pool)
|
return CompletableFuture.supplyAsync(supplier, pool)
|
||||||
.thenCompose({ s -> CompletableFuture.supplyAsync(new AppendingSupplier(s), differentPool) })
|
.thenCompose({ s -> CompletableFuture.supplyAsync(new AppendingSupplier(s), differentPool) })
|
||||||
.thenApply(function)
|
.thenApply(function)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import datadog.trace.context.TraceScope
|
import datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import slick.jdbc.H2Profile.api._
|
import slick.jdbc.H2Profile.api._
|
||||||
|
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
|
@ -22,7 +21,7 @@ class SlickUtils {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
def startQuery(query: String): Future[Vector[Int]] = {
|
def startQuery(query: String): Future[Vector[Int]] = {
|
||||||
GlobalTracer.get().scopeManager().active().asInstanceOf[TraceScope].setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
database.run(sql"#$query".as[Int])
|
database.run(sql"#$query".as[Int])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import datadog.opentracing.DDSpan
|
import datadog.opentracing.DDSpan
|
||||||
import datadog.opentracing.scopemanager.ContinuableScope
|
|
||||||
import datadog.trace.agent.test.AgentTestRunner
|
import datadog.trace.agent.test.AgentTestRunner
|
||||||
import datadog.trace.agent.test.utils.ConfigUtils
|
import datadog.trace.agent.test.utils.ConfigUtils
|
||||||
import datadog.trace.api.Trace
|
import datadog.trace.api.Trace
|
||||||
import datadog.trace.bootstrap.instrumentation.java.concurrent.CallableWrapper
|
import datadog.trace.bootstrap.instrumentation.java.concurrent.CallableWrapper
|
||||||
import datadog.trace.bootstrap.instrumentation.java.concurrent.RunnableWrapper
|
import datadog.trace.bootstrap.instrumentation.java.concurrent.RunnableWrapper
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
|
@ -25,6 +23,7 @@ import java.util.concurrent.ThreadPoolExecutor
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.concurrent.TimeoutException
|
import java.util.concurrent.TimeoutException
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
import static org.junit.Assume.assumeTrue
|
import static org.junit.Assume.assumeTrue
|
||||||
|
|
||||||
class ExecutorInstrumentationTest extends AgentTestRunner {
|
class ExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
|
@ -70,7 +69,7 @@ class ExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
// this child will have a span
|
// this child will have a span
|
||||||
m(pool, new JavaAsyncChild())
|
m(pool, new JavaAsyncChild())
|
||||||
// this child won't
|
// this child won't
|
||||||
|
@ -151,7 +150,7 @@ class ExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
m(pool, w(child))
|
m(pool, w(child))
|
||||||
}
|
}
|
||||||
}.run()
|
}.run()
|
||||||
|
@ -195,7 +194,7 @@ class ExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
@Override
|
@Override
|
||||||
@Trace(operationName = "parent")
|
@Trace(operationName = "parent")
|
||||||
void run() {
|
void run() {
|
||||||
((ContinuableScope) GlobalTracer.get().scopeManager().active()).setAsyncPropagation(true)
|
activeScope().setAsyncPropagation(true)
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 20; ++i) {
|
for (int i = 0; i < 20; ++i) {
|
||||||
// Our current instrumentation instrumentation does not behave very well
|
// Our current instrumentation instrumentation does not behave very well
|
||||||
|
|
|
@ -1,61 +1,54 @@
|
||||||
package dd.test.trace.annotation;
|
package dd.test.trace.annotation;
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeSpan;
|
||||||
|
|
||||||
import datadog.trace.api.DDTags;
|
import datadog.trace.api.DDTags;
|
||||||
import datadog.trace.api.Trace;
|
import datadog.trace.api.Trace;
|
||||||
import io.opentracing.tag.StringTag;
|
|
||||||
import io.opentracing.util.GlobalTracer;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
public class SayTracedHello {
|
public class SayTracedHello {
|
||||||
|
|
||||||
@Trace
|
@Trace
|
||||||
public static String sayHello() {
|
public static String sayHello() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test");
|
|
||||||
return "hello!";
|
return "hello!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace(resourceName = "WORLD")
|
@Trace(resourceName = "WORLD")
|
||||||
public static String sayHelloOnlyResourceSet() {
|
public static String sayHelloOnlyResourceSet() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test");
|
|
||||||
return "hello!";
|
return "hello!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace(operationName = "SAY_HA")
|
@Trace(operationName = "SAY_HA")
|
||||||
public static String sayHA() {
|
public static String sayHA() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test");
|
activeSpan().setTag(DDTags.SPAN_TYPE, "DB");
|
||||||
new StringTag(DDTags.SPAN_TYPE).set(GlobalTracer.get().scopeManager().active().span(), "DB");
|
|
||||||
return "HA!!";
|
return "HA!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace(operationName = "SAY_HA", resourceName = "EARTH")
|
@Trace(operationName = "SAY_HA", resourceName = "EARTH")
|
||||||
public static String sayHAWithResource() {
|
public static String sayHAWithResource() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test");
|
activeSpan().setTag(DDTags.SPAN_TYPE, "DB");
|
||||||
new StringTag(DDTags.SPAN_TYPE).set(GlobalTracer.get().scopeManager().active().span(), "DB");
|
|
||||||
return "HA EARTH!!";
|
return "HA EARTH!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace(operationName = "NEW_TRACE")
|
@Trace(operationName = "NEW_TRACE")
|
||||||
public static String sayHELLOsayHA() {
|
public static String sayHELLOsayHA() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test2");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test2");
|
|
||||||
return sayHello() + sayHA();
|
return sayHello() + sayHA();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace(operationName = "NEW_TRACE", resourceName = "WORLD")
|
@Trace(operationName = "NEW_TRACE", resourceName = "WORLD")
|
||||||
public static String sayHELLOsayHAWithResource() {
|
public static String sayHELLOsayHAWithResource() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test2");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test2");
|
|
||||||
return sayHello() + sayHA();
|
return sayHello() + sayHA();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Trace(operationName = "NEW_TRACE", resourceName = "WORLD")
|
@Trace(operationName = "NEW_TRACE", resourceName = "WORLD")
|
||||||
public static String sayHELLOsayHAMixedResourceChildren() {
|
public static String sayHELLOsayHAMixedResourceChildren() {
|
||||||
new StringTag(DDTags.SERVICE_NAME)
|
activeSpan().setTag(DDTags.SERVICE_NAME, "test2");
|
||||||
.set(GlobalTracer.get().scopeManager().active().span(), "test2");
|
|
||||||
return sayHello() + sayHAWithResource();
|
return sayHello() + sayHAWithResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import com.twilio.type.PhoneNumber
|
||||||
import datadog.trace.agent.test.AgentTestRunner
|
import datadog.trace.agent.test.AgentTestRunner
|
||||||
import datadog.trace.api.DDSpanTypes
|
import datadog.trace.api.DDSpanTypes
|
||||||
import io.opentracing.tag.Tags
|
import io.opentracing.tag.Tags
|
||||||
import io.opentracing.util.GlobalTracer
|
|
||||||
import org.apache.http.HttpEntity
|
import org.apache.http.HttpEntity
|
||||||
import org.apache.http.HttpStatus
|
import org.apache.http.HttpStatus
|
||||||
import org.apache.http.StatusLine
|
import org.apache.http.StatusLine
|
||||||
|
@ -24,6 +23,11 @@ import org.apache.http.impl.client.HttpClientBuilder
|
||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activateSpan
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeScope
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.activeSpan
|
||||||
|
import static datadog.trace.instrumentation.api.AgentTracer.startSpan
|
||||||
|
|
||||||
class TwilioClientTest extends AgentTestRunner {
|
class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
final static String ACCOUNT_SID = "abc"
|
final static String ACCOUNT_SID = "abc"
|
||||||
|
@ -110,7 +114,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(MESSAGE_RESPONSE_BODY.getBytes()), 200)
|
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(MESSAGE_RESPONSE_BODY.getBytes()), 200)
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
Message message = Message.creator(
|
Message message = Message.creator(
|
||||||
new PhoneNumber("+1 555 720 5913"), // To number
|
new PhoneNumber("+1 555 720 5913"), // To number
|
||||||
|
@ -118,7 +122,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
"Hello world!" // SMS body
|
"Hello world!" // SMS body
|
||||||
).create(twilioRestClient)
|
).create(twilioRestClient)
|
||||||
|
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
|
@ -162,7 +166,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(CALL_RESPONSE_BODY.getBytes()), 200)
|
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(CALL_RESPONSE_BODY.getBytes()), 200)
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
Call call = Call.creator(
|
Call call = Call.creator(
|
||||||
new PhoneNumber("+15558881234"), // To number
|
new PhoneNumber("+15558881234"), // To number
|
||||||
|
@ -172,7 +176,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
new URI("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
|
new URI("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
|
||||||
).create(twilioRestClient)
|
).create(twilioRestClient)
|
||||||
|
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
|
@ -240,7 +244,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
.httpClient(networkHttpClient)
|
.httpClient(networkHttpClient)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
Message message = Message.creator(
|
Message message = Message.creator(
|
||||||
new PhoneNumber("+1 555 720 5913"), // To number
|
new PhoneNumber("+1 555 720 5913"), // To number
|
||||||
|
@ -248,7 +252,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
"Hello world!" // SMS body
|
"Hello world!" // SMS body
|
||||||
).create(realTwilioRestClient)
|
).create(realTwilioRestClient)
|
||||||
|
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
|
@ -339,7 +343,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
.httpClient(networkHttpClient)
|
.httpClient(networkHttpClient)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
Message message = Message.creator(
|
Message message = Message.creator(
|
||||||
new PhoneNumber("+1 555 720 5913"), // To number
|
new PhoneNumber("+1 555 720 5913"), // To number
|
||||||
|
@ -347,7 +351,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
"Hello world!" // SMS body
|
"Hello world!" // SMS body
|
||||||
).create(realTwilioRestClient)
|
).create(realTwilioRestClient)
|
||||||
|
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
|
@ -445,7 +449,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
.httpClient(networkHttpClient)
|
.httpClient(networkHttpClient)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
ListenableFuture<Message> future = Message.creator(
|
ListenableFuture<Message> future = Message.creator(
|
||||||
new PhoneNumber("+1 555 720 5913"), // To number
|
new PhoneNumber("+1 555 720 5913"), // To number
|
||||||
|
@ -459,9 +463,9 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
} finally {
|
} finally {
|
||||||
// Give the future callback a chance to run
|
// Give the future callback a chance to run
|
||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.span().finish()
|
activeSpan().finish()
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,7 +547,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(ERROR_RESPONSE_BODY.getBytes()), 500)
|
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(ERROR_RESPONSE_BODY.getBytes()), 500)
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
when:
|
when:
|
||||||
Message.creator(
|
Message.creator(
|
||||||
|
@ -555,7 +559,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
then:
|
then:
|
||||||
thrown(ApiException)
|
thrown(ApiException)
|
||||||
|
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
|
@ -629,7 +633,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
when:
|
when:
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
ListenableFuture<Message> future = Message.creator(
|
ListenableFuture<Message> future = Message.creator(
|
||||||
new PhoneNumber("+1 555 720 5913"), // To number
|
new PhoneNumber("+1 555 720 5913"), // To number
|
||||||
|
@ -643,9 +647,9 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
} finally {
|
} finally {
|
||||||
// Give the future callback a chance to run
|
// Give the future callback a chance to run
|
||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.span().finish()
|
activeSpan().finish()
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,7 +720,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(ERROR_RESPONSE_BODY.getBytes()), 500)
|
1 * twilioRestClient.request(_) >> new Response(new ByteArrayInputStream(ERROR_RESPONSE_BODY.getBytes()), 500)
|
||||||
|
|
||||||
GlobalTracer.get().buildSpan("test").startActive(true)
|
activateSpan(startSpan("test"), true)
|
||||||
|
|
||||||
ListenableFuture<Message> future = Message.creator(
|
ListenableFuture<Message> future = Message.creator(
|
||||||
new PhoneNumber("+1 555 720 5913"), // To number
|
new PhoneNumber("+1 555 720 5913"), // To number
|
||||||
|
@ -732,7 +736,7 @@ class TwilioClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
def scope = GlobalTracer.get().scopeManager().active()
|
def scope = activeScope()
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope.close()
|
scope.close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue