forked from census-instrumentation/opencensus-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScopeManager.java
More file actions
63 lines (47 loc) · 1.58 KB
/
ScopeManager.java
File metadata and controls
63 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package io.opencensus.trace;
import io.opencensus.common.Scope;
import io.opencensus.tags.TagContext;
import io.opencensus.tags.BlankTagContext;
import java.util.concurrent.Callable;
public interface ScopeManager {
Span activeSpan();
TagContext activeTagContext();
Scope withSpan(Span span);
Scope withSpan(Span span, boolean finishSpanOnClose);
Runnable withSpan(Span span, boolean finishSpanOnClose, Runnable runnable);
<C> Callable<C> withSpan(Span span, boolean finishSpanOnClose, Callable<C> callable);
Scope withTagContext(TagContext context);
static final class NoopScopeManager implements ScopeManager {
public static final ScopeManager INSTANCE = new NoopScopeManager();
private NoopScopeManager() {
}
@Override
public Span activeSpan() {
return BlankSpan.INSTANCE;
}
@Override
public TagContext activeTagContext() {
return BlankTagContext.INSTANCE;
}
@Override
public Scope withSpan(Span span) {
return BlankScope.INSTANCE;
}
@Override
public Scope withSpan(Span span, boolean finishSpanOnClose) {
return BlankScope.INSTANCE;
}
@Override
public Runnable withSpan(Span span, boolean finishSpanOnClose, Runnable runnable) {
return runnable;
}
@Override
public <C> Callable<C> withSpan(Span span, boolean finishSpanOnClose, Callable<C> callable) {
return callable;
}
@Override
public Scope withTagContext(TagContext context) {
return BlankScope.INSTANCE;
}
}
}