|
6 | 6 |
|
7 | 7 | /** An object which can propagate a datadog trace across multiple threads. */
|
8 | 8 | public interface TraceScope extends Closeable {
|
9 |
| - /** |
10 |
| - * Prevent the trace attached to this TraceScope from reporting until the returned Continuation is |
11 |
| - * either activated (and the returned scope is closed), or canceled. |
12 |
| - * |
13 |
| - * <p>Should be called on the parent thread. |
14 |
| - */ |
15 |
| - Continuation capture(); |
16 |
| - |
17 |
| - /** @deprecated Replaced by {@code capture().hold()}. */ |
18 |
| - @Deprecated |
19 |
| - default Continuation captureConcurrent() { |
20 |
| - return capture().hold(); |
21 |
| - } |
22 | 9 |
|
23 | 10 | /** Close the activated context and allow any underlying spans to finish. */
|
24 | 11 | @Override
|
25 | 12 | void close();
|
26 | 13 |
|
27 |
| - /** |
28 |
| - * @deprecated Replaced by {@link Tracer#isAsyncPropagationEnabled()}. |
29 |
| - * <p>Calling this method will check whether asynchronous propagation is active <strong>for |
30 |
| - * the active scope</strong>, not this scope instance. |
31 |
| - * @return {@code true} if asynchronous propagation is enabled <strong>for the active |
32 |
| - * scope</strong>, {@code false} otherwise. |
33 |
| - */ |
34 |
| - @Deprecated |
35 |
| - default boolean isAsyncPropagating() { |
36 |
| - return GlobalTracer.get().isAsyncPropagationEnabled(); |
37 |
| - } |
38 |
| - |
39 |
| - /** |
40 |
| - * @deprecated Replaced by {@link Tracer#setAsyncPropagationEnabled(boolean)}}. |
41 |
| - * <p>Calling this method will enable or disable asynchronous propagation <strong>for the |
42 |
| - * active scope</strong>, not this scope instance. |
43 |
| - * @param value {@code true} to enable asynchronous propagation, {@code false} to disable it. |
44 |
| - */ |
45 |
| - @Deprecated |
46 |
| - default void setAsyncPropagation(boolean value) { |
47 |
| - GlobalTracer.get().setAsyncPropagationEnabled(value); |
48 |
| - } |
49 |
| - |
50 | 14 | /**
|
51 | 15 | * Used to pass async context between workers. A trace will not be reported until all spans and
|
52 | 16 | * continuations are resolved. You must call activate (and close on the returned scope) or cancel
|
@@ -76,4 +40,47 @@ interface Continuation {
|
76 | 40 | /** Allow trace to stop waiting on this continuation for reporting. */
|
77 | 41 | void cancel();
|
78 | 42 | }
|
| 43 | + |
| 44 | + /** |
| 45 | + * @deprecated Replaced by {@link Tracer#captureActiveSpan()}. |
| 46 | + * <p>When asynchronous propagation is enabled, prevent the <strong>currently active |
| 47 | + * trace</strong>, which may differ from this scope instance, from reporting until the |
| 48 | + * returned Continuation is either activated (and the returned scope is closed) or the |
| 49 | + * continuation is canceled. Should be called on the parent thread. |
| 50 | + * @return Continuation of the active span, no-op continuation if there's no active span or |
| 51 | + * asynchronous propagation is disabled. |
| 52 | + */ |
| 53 | + @Deprecated |
| 54 | + default Continuation capture() { |
| 55 | + return GlobalTracer.get().captureActiveSpan(); |
| 56 | + } |
| 57 | + |
| 58 | + /** @deprecated Replaced by {@code capture().hold()}. */ |
| 59 | + @Deprecated |
| 60 | + default Continuation captureConcurrent() { |
| 61 | + return capture().hold(); |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * @deprecated Replaced by {@link Tracer#isAsyncPropagationEnabled()}. |
| 66 | + * <p>Calling this method will check whether asynchronous propagation is enabled <strong>for |
| 67 | + * the active scope</strong>, not this scope instance. |
| 68 | + * @return {@code true} if asynchronous propagation is enabled <strong>for the active |
| 69 | + * scope</strong>, {@code false} otherwise. |
| 70 | + */ |
| 71 | + @Deprecated |
| 72 | + default boolean isAsyncPropagating() { |
| 73 | + return GlobalTracer.get().isAsyncPropagationEnabled(); |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * @deprecated Replaced by {@link Tracer#setAsyncPropagationEnabled(boolean)}}. |
| 78 | + * <p>Calling this method will enable or disable asynchronous propagation <strong>for the |
| 79 | + * active scope</strong>, not this scope instance. |
| 80 | + * @param value {@code true} to enable asynchronous propagation, {@code false} to disable it. |
| 81 | + */ |
| 82 | + @Deprecated |
| 83 | + default void setAsyncPropagation(boolean value) { |
| 84 | + GlobalTracer.get().setAsyncPropagationEnabled(value); |
| 85 | + } |
79 | 86 | }
|
0 commit comments