Skip to content

Commit f14e8d6

Browse files
authored
Remove unused activeScope method (#8531)
1 parent 819daaa commit f14e8d6

File tree

7 files changed

+21
-39
lines changed

7 files changed

+21
-39
lines changed

dd-java-agent/instrumentation/akka-concurrent/src/akka23Test/scala/AkkaActors.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import akka.util.Timeout
66
import datadog.trace.api.Trace
77
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{
88
activateSpan,
9-
activeScope,
9+
setAsyncPropagationEnabled,
1010
activeSpan,
1111
startSpan
1212
}
@@ -57,7 +57,7 @@ class AkkaActors extends AutoCloseable {
5757
@Trace
5858
def send(name: String, who: String): Unit = {
5959
val actor = actors(name)
60-
activeScope().setAsyncPropagation(true)
60+
setAsyncPropagationEnabled(true)
6161
activeSpan().setSpanName(name)
6262
actor ! WhoToGreet(who)
6363
if (name == "ask") {
@@ -69,7 +69,7 @@ class AkkaActors extends AutoCloseable {
6969

7070
@Trace
7171
def leak(who: String, leak: String): Unit = {
72-
activeScope().setAsyncPropagation(true)
72+
setAsyncPropagationEnabled(true)
7373
activeSpan().setSpanName("leak all the things")
7474
tellGreeter ! WhoToGreet(who)
7575
tellGreeter ! Leak(leak)

dd-java-agent/instrumentation/pekko-concurrent/src/test/scala/PekkoActors.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.apache.pekko.util.Timeout
66
import datadog.trace.api.Trace
77
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{
88
activateSpan,
9-
activeScope,
9+
setAsyncPropagationEnabled,
1010
activeSpan,
1111
startSpan
1212
}
@@ -55,7 +55,7 @@ class PekkoActors extends AutoCloseable {
5555
@Trace
5656
def send(name: String, who: String): Unit = {
5757
val actor = actors(name)
58-
activeScope().setAsyncPropagation(true)
58+
setAsyncPropagationEnabled(true)
5959
activeSpan().setSpanName(name)
6060
actor ! WhoToGreet(who)
6161
if (name == "ask") {
@@ -67,7 +67,7 @@ class PekkoActors extends AutoCloseable {
6767

6868
@Trace
6969
def leak(who: String, leak: String): Unit = {
70-
activeScope().setAsyncPropagation(true)
70+
setAsyncPropagationEnabled(true)
7171
activeSpan().setSpanName("leak all the things")
7272
tellGreeter ! WhoToGreet(who)
7373
tellGreeter ! Leak(leak)

dd-java-agent/instrumentation/scala-concurrent/src/latestDepTest/scala/ScalaConcurrentTests.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datadog.trace.agent.test.AgentTestRunner.blockUntilChildSpansFinished
22
import datadog.trace.api.Trace
3-
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{activeScope, activeSpan}
3+
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{setAsyncPropagationEnabled, activeSpan}
44

55
import scala.concurrent.ExecutionContext.Implicits.global
66
import scala.concurrent.duration._
@@ -13,7 +13,7 @@ class ScalaConcurrentTests {
1313
*/
1414
@Trace
1515
def traceWithFutureAndCallbacks(): Integer = {
16-
activeScope().setAsyncPropagation(true)
16+
setAsyncPropagationEnabled(true)
1717
val goodFuture: Future[Integer] = Future {
1818
tracedChild("goodFuture")
1919
1
@@ -31,7 +31,7 @@ class ScalaConcurrentTests {
3131

3232
@Trace
3333
def tracedAcrossThreadsWithNoTrace(): Integer = {
34-
activeScope().setAsyncPropagation(true)
34+
setAsyncPropagationEnabled(true)
3535
val goodFuture: Future[Integer] = Future {
3636
1
3737
}
@@ -51,7 +51,7 @@ class ScalaConcurrentTests {
5151
*/
5252
@Trace
5353
def traceWithPromises(): Integer = {
54-
activeScope().setAsyncPropagation(true)
54+
setAsyncPropagationEnabled(true)
5555
val keptPromise = Promise[Boolean]()
5656
val brokenPromise = Promise[Boolean]()
5757
val afterPromise = keptPromise.future
@@ -78,7 +78,7 @@ class ScalaConcurrentTests {
7878
*/
7979
@Trace
8080
def tracedWithFutureFirstCompletions(): Integer = {
81-
activeScope().setAsyncPropagation(true)
81+
setAsyncPropagationEnabled(true)
8282
val completedVal = Future.firstCompletedOf(List(Future {
8383
tracedChild("timeout1")
8484
false
@@ -100,7 +100,7 @@ class ScalaConcurrentTests {
100100
*/
101101
@Trace
102102
def tracedTimeout(): Integer = {
103-
activeScope().setAsyncPropagation(true)
103+
setAsyncPropagationEnabled(true)
104104
val f: Future[String] = Future {
105105
tracedChild("timeoutChild")
106106
while (true) {

dd-java-agent/instrumentation/scala-concurrent/src/test/scala/ScalaConcurrentTests.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datadog.trace.agent.test.AgentTestRunner.blockUntilChildSpansFinished
22
import datadog.trace.api.Trace
3-
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{activeScope, activeSpan}
3+
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{setAsyncPropagationEnabled, activeSpan}
44

55
import scala.concurrent.ExecutionContext.Implicits.global
66
import scala.concurrent.duration._
@@ -13,7 +13,7 @@ class ScalaConcurrentTests {
1313
*/
1414
@Trace
1515
def traceWithFutureAndCallbacks(): Integer = {
16-
activeScope().setAsyncPropagation(true)
16+
setAsyncPropagationEnabled(true)
1717
val goodFuture: Future[Integer] = Future {
1818
tracedChild("goodFuture")
1919
1
@@ -31,7 +31,7 @@ class ScalaConcurrentTests {
3131

3232
@Trace
3333
def tracedAcrossThreadsWithNoTrace(): Integer = {
34-
activeScope().setAsyncPropagation(true)
34+
setAsyncPropagationEnabled(true)
3535
val goodFuture: Future[Integer] = Future {
3636
1
3737
}
@@ -51,7 +51,7 @@ class ScalaConcurrentTests {
5151
*/
5252
@Trace
5353
def traceWithPromises(): Integer = {
54-
activeScope().setAsyncPropagation(true)
54+
setAsyncPropagationEnabled(true)
5555
val keptPromise = Promise[Boolean]()
5656
val brokenPromise = Promise[Boolean]()
5757
val afterPromise = keptPromise.future
@@ -78,7 +78,7 @@ class ScalaConcurrentTests {
7878
*/
7979
@Trace
8080
def tracedWithFutureFirstCompletions(): Integer = {
81-
activeScope().setAsyncPropagation(true)
81+
setAsyncPropagationEnabled(true)
8282
val completedVal = Future.firstCompletedOf(List(Future {
8383
tracedChild("timeout1")
8484
false
@@ -100,7 +100,7 @@ class ScalaConcurrentTests {
100100
*/
101101
@Trace
102102
def tracedTimeout(): Integer = {
103-
activeScope().setAsyncPropagation(true)
103+
setAsyncPropagationEnabled(true)
104104
val f: Future[String] = Future {
105105
tracedChild("timeoutChild")
106106
while (true) {

dd-java-agent/instrumentation/slick/src/test/scala/SlickUtils.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datadog.trace.agent.test.AgentTestRunner.blockUntilChildSpansFinished
22
import datadog.trace.api.Trace
3-
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{activeScope, activeSpan}
3+
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{setAsyncPropagationEnabled, activeSpan}
44
import datadog.trace.common.writer.ListWriter
55
import datadog.trace.core.DDSpan
66
import slick.jdbc.H2Profile.api._
@@ -26,7 +26,7 @@ class SlickUtils(TEST_WRITER: ListWriter) {
2626

2727
@Trace
2828
def setup(): DDSpan = {
29-
activeScope().setAsyncPropagation(true)
29+
setAsyncPropagationEnabled(true)
3030
Await.result(
3131
database.run(
3232
sqlu"""CREATE ALIAS IF NOT EXISTS SLEEP FOR "java.lang.Thread.sleep(long)""""
@@ -39,7 +39,7 @@ class SlickUtils(TEST_WRITER: ListWriter) {
3939
@Trace
4040
def startQuery(query: String): Future[Vector[Int]] = {
4141
try {
42-
activeScope().setAsyncPropagation(true)
42+
setAsyncPropagationEnabled(true)
4343
database.run(sql"#$query".as[Int])
4444
} finally {
4545
blockUntilChildSpansFinished(activeSpan(), 1)

dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -966,11 +966,6 @@ public AgentSpan activeSpan() {
966966
return scopeManager.activeSpan();
967967
}
968968

969-
@Override
970-
public AgentScope activeScope() {
971-
return scopeManager.active();
972-
}
973-
974969
@Override
975970
public void checkpointActiveForRollback() {
976971
this.scopeManager.checkpointActiveForRollback();

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ public static AgentSpan activeSpan() {
185185
return get().activeSpan();
186186
}
187187

188-
/** @deprecated To be removed, do not use. */
189-
@Deprecated
190-
public static AgentScope activeScope() {
191-
return get().activeScope();
192-
}
193-
194188
/**
195189
* Checks whether asynchronous propagation is enabled, meaning this context will propagate across
196190
* asynchronous boundaries.
@@ -359,8 +353,6 @@ AgentSpan startSpan(
359353

360354
AgentSpan activeSpan();
361355

362-
AgentScope activeScope();
363-
364356
default AgentSpan blackholeSpan() {
365357
final AgentSpan active = activeSpan();
366358
return new BlackHoleSpan(active != null ? active.getTraceId() : DDTraceId.ZERO);
@@ -528,11 +520,6 @@ public AgentSpan activeSpan() {
528520
return NoopSpan.INSTANCE;
529521
}
530522

531-
@Override
532-
public AgentScope activeScope() {
533-
return null;
534-
}
535-
536523
@Override
537524
public AgentSpan blackholeSpan() {
538525
return NoopSpan.INSTANCE; // no-op tracer stays no-op

0 commit comments

Comments
 (0)