Skip to content

Remove unused activeScope method #8531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import akka.util.Timeout
import datadog.trace.api.Trace
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{
activateSpan,
activeScope,
setAsyncPropagationEnabled,
activeSpan,
startSpan
}
Expand Down Expand Up @@ -57,7 +57,7 @@ class AkkaActors extends AutoCloseable {
@Trace
def send(name: String, who: String): Unit = {
val actor = actors(name)
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
activeSpan().setSpanName(name)
actor ! WhoToGreet(who)
if (name == "ask") {
Expand All @@ -69,7 +69,7 @@ class AkkaActors extends AutoCloseable {

@Trace
def leak(who: String, leak: String): Unit = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
activeSpan().setSpanName("leak all the things")
tellGreeter ! WhoToGreet(who)
tellGreeter ! Leak(leak)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.apache.pekko.util.Timeout
import datadog.trace.api.Trace
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{
activateSpan,
activeScope,
setAsyncPropagationEnabled,
activeSpan,
startSpan
}
Expand Down Expand Up @@ -55,7 +55,7 @@ class PekkoActors extends AutoCloseable {
@Trace
def send(name: String, who: String): Unit = {
val actor = actors(name)
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
activeSpan().setSpanName(name)
actor ! WhoToGreet(who)
if (name == "ask") {
Expand All @@ -67,7 +67,7 @@ class PekkoActors extends AutoCloseable {

@Trace
def leak(who: String, leak: String): Unit = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
activeSpan().setSpanName("leak all the things")
tellGreeter ! WhoToGreet(who)
tellGreeter ! Leak(leak)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datadog.trace.agent.test.AgentTestRunner.blockUntilChildSpansFinished
import datadog.trace.api.Trace
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{activeScope, activeSpan}
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{setAsyncPropagationEnabled, activeSpan}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
Expand All @@ -13,7 +13,7 @@ class ScalaConcurrentTests {
*/
@Trace
def traceWithFutureAndCallbacks(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val goodFuture: Future[Integer] = Future {
tracedChild("goodFuture")
1
Expand All @@ -31,7 +31,7 @@ class ScalaConcurrentTests {

@Trace
def tracedAcrossThreadsWithNoTrace(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val goodFuture: Future[Integer] = Future {
1
}
Expand All @@ -51,7 +51,7 @@ class ScalaConcurrentTests {
*/
@Trace
def traceWithPromises(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val keptPromise = Promise[Boolean]()
val brokenPromise = Promise[Boolean]()
val afterPromise = keptPromise.future
Expand All @@ -78,7 +78,7 @@ class ScalaConcurrentTests {
*/
@Trace
def tracedWithFutureFirstCompletions(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val completedVal = Future.firstCompletedOf(List(Future {
tracedChild("timeout1")
false
Expand All @@ -100,7 +100,7 @@ class ScalaConcurrentTests {
*/
@Trace
def tracedTimeout(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val f: Future[String] = Future {
tracedChild("timeoutChild")
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datadog.trace.agent.test.AgentTestRunner.blockUntilChildSpansFinished
import datadog.trace.api.Trace
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{activeScope, activeSpan}
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{setAsyncPropagationEnabled, activeSpan}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
Expand All @@ -13,7 +13,7 @@ class ScalaConcurrentTests {
*/
@Trace
def traceWithFutureAndCallbacks(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val goodFuture: Future[Integer] = Future {
tracedChild("goodFuture")
1
Expand All @@ -31,7 +31,7 @@ class ScalaConcurrentTests {

@Trace
def tracedAcrossThreadsWithNoTrace(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val goodFuture: Future[Integer] = Future {
1
}
Expand All @@ -51,7 +51,7 @@ class ScalaConcurrentTests {
*/
@Trace
def traceWithPromises(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val keptPromise = Promise[Boolean]()
val brokenPromise = Promise[Boolean]()
val afterPromise = keptPromise.future
Expand All @@ -78,7 +78,7 @@ class ScalaConcurrentTests {
*/
@Trace
def tracedWithFutureFirstCompletions(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val completedVal = Future.firstCompletedOf(List(Future {
tracedChild("timeout1")
false
Expand All @@ -100,7 +100,7 @@ class ScalaConcurrentTests {
*/
@Trace
def tracedTimeout(): Integer = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
val f: Future[String] = Future {
tracedChild("timeoutChild")
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datadog.trace.agent.test.AgentTestRunner.blockUntilChildSpansFinished
import datadog.trace.api.Trace
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{activeScope, activeSpan}
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.{setAsyncPropagationEnabled, activeSpan}
import datadog.trace.common.writer.ListWriter
import datadog.trace.core.DDSpan
import slick.jdbc.H2Profile.api._
Expand All @@ -26,7 +26,7 @@ class SlickUtils(TEST_WRITER: ListWriter) {

@Trace
def setup(): DDSpan = {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
Await.result(
database.run(
sqlu"""CREATE ALIAS IF NOT EXISTS SLEEP FOR "java.lang.Thread.sleep(long)""""
Expand All @@ -39,7 +39,7 @@ class SlickUtils(TEST_WRITER: ListWriter) {
@Trace
def startQuery(query: String): Future[Vector[Int]] = {
try {
activeScope().setAsyncPropagation(true)
setAsyncPropagationEnabled(true)
database.run(sql"#$query".as[Int])
} finally {
blockUntilChildSpansFinished(activeSpan(), 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -966,11 +966,6 @@ public AgentSpan activeSpan() {
return scopeManager.activeSpan();
}

@Override
public AgentScope activeScope() {
return scopeManager.active();
}

@Override
public void checkpointActiveForRollback() {
this.scopeManager.checkpointActiveForRollback();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ public static AgentSpan activeSpan() {
return get().activeSpan();
}

/** @deprecated To be removed, do not use. */
@Deprecated
public static AgentScope activeScope() {
return get().activeScope();
}

/**
* Checks whether asynchronous propagation is enabled, meaning this context will propagate across
* asynchronous boundaries.
Expand Down Expand Up @@ -359,8 +353,6 @@ AgentSpan startSpan(

AgentSpan activeSpan();

AgentScope activeScope();

default AgentSpan blackholeSpan() {
final AgentSpan active = activeSpan();
return new BlackHoleSpan(active != null ? active.getTraceId() : DDTraceId.ZERO);
Expand Down Expand Up @@ -528,11 +520,6 @@ public AgentSpan activeSpan() {
return NoopSpan.INSTANCE;
}

@Override
public AgentScope activeScope() {
return null;
}

@Override
public AgentSpan blackholeSpan() {
return NoopSpan.INSTANCE; // no-op tracer stays no-op
Expand Down