-
Notifications
You must be signed in to change notification settings - Fork 0
/
noop.go
45 lines (30 loc) · 897 Bytes
/
noop.go
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
package trace
var _ Tracer = noopTracer{}
type noopTracer struct{}
func (n noopTracer) New(title string, opts ...Option) Trace {
return noopSpan{}
}
func (n noopTracer) Inject(t Trace, format interface{}, carrier interface{}) error {
return nil
}
func (n noopTracer) Extract(format interface{}, carrier interface{}) (Trace, error) {
return noopSpan{}, nil
}
type noopSpan struct{}
func (n noopSpan) TraceId() string { return "" }
func (n noopSpan) Fork(string, string) Trace {
return noopSpan{}
}
func (n noopSpan) Follow(string, string) Trace {
return noopSpan{}
}
func (n noopSpan) Finish(err *error) {}
func (n noopSpan) SetTag(tags ...Tag) Trace {
return noopSpan{}
}
func (n noopSpan) SetLog(logs ...LogField) Trace {
return noopSpan{}
}
func (n noopSpan) Visit(func(k, v string)) {}
func (n noopSpan) SetTitle(string) {}
func (n noopSpan) String() string { return "" }