New API: remove `reportWarning` from tracer and use logger instead
MODIFY
dd-trace/src/main/java/datadog/trace/tracer/ContinuationImpl.java
dd-trace/src/main/java/datadog/trace/tracer/ContinuationImpl.java
@@ -43,11 +43,7 @@ class ContinuationImpl implements Continuation {
protected synchronized void finalize() {
try {
if (!closed) {
- trace
- .getTracer()
- .reportWarning(
- "Closing continuation due to GC, this will prevent trace from being reported: %s",
- this);
+ log.debug("Closing continuation due to GC, this will prevent trace from being reported: {}", this);
closeContinuation(true);
}
} catch (final Throwable t) {

MODIFY
dd-trace/src/main/java/datadog/trace/tracer/SpanImpl.java
dd-trace/src/main/java/datadog/trace/tracer/SpanImpl.java
@@ -280,10 +280,7 @@ class SpanImpl implements Span {
// instance is 'revived' from the dead by passing reference to some other object and
// then dies again.
if (!isFinished()) {
- trace
- .getTracer()
- .reportWarning(
- "Finishing span due to GC, this will prevent trace from being reported: %s", this);
+ log.debug("Finishing span due to GC, this will prevent trace from being reported: {}", this);
finishSpan(startTimestamp.getDuration(), true);
}
} catch (final Throwable t) {

MODIFY
dd-trace/src/main/java/datadog/trace/tracer/Tracer.java
dd-trace/src/main/java/datadog/trace/tracer/Tracer.java
@@ -115,17 +115,6 @@ public class Tracer {
return null;
}
- // TODO: we can move these two into a separate class and move all '*Impl' and '*Internal' classes
- // into separate package
- // TODO: provide some sort of ratelimiting here to avoid filling up disk space.
- /*
- Report warning to the log/console. This never throws exception
- */
- void reportWarning(final String message, final Object... args) {
- final String completeMessage = String.format(message, args);
- log.debug(completeMessage);
- }
-
/*
Report error to the log/console. This may throw an exception
*/

MODIFY
dd-trace/src/test/groovy/datadog/trace/tracer/ContinuationImplTest.groovy
dd-trace/src/test/groovy/datadog/trace/tracer/ContinuationImplTest.groovy
@@ -76,8 +76,6 @@ class ContinuationImplTest extends Specification {
continuation.isClosed()
and: "continuation is reported as closed to a trace"
1 * trace.closeContinuation(continuation, true)
- and: "warning is reported"
- 1 * tracer.reportWarning(_, [continuation])
when: "finalize continuation again"
continuation.finalize()
@@ -98,7 +96,7 @@ class ContinuationImplTest extends Specification {
continuation.finalize()
then:
- 1 * trace.getTracer() >> { throw new Throwable() }
+ 1 * trace.closeContinuation(_, _) >> { throw new Throwable() }
noExceptionThrown()
}

MODIFY
dd-trace/src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy
dd-trace/src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy
@@ -228,11 +228,6 @@ class SpanImplTest extends Specification {
when: "finish/finalize span"
span."$method"(*methodArgs)
- then: "warning is reported"
- _ * trace.getTracer() >> tracer
- if (finalizeErrorReported) {
- 1 * tracer.reportWarning(_, span)
- }
then: "interceptors called"
interceptors.reverseEach({ interceptor ->
then:

New API: remove `reportWarning` from tracer and use logger instead