2020-09-10 00:06:29 +03:00
|
|
|
package tracer
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
2020-11-03 01:57:11 +03:00
|
|
|
type noopTracer struct {
|
|
|
|
opts Options
|
|
|
|
}
|
2020-09-10 00:06:29 +03:00
|
|
|
|
2020-11-03 01:57:11 +03:00
|
|
|
// Init initilize tracer
|
|
|
|
func (n *noopTracer) Init(opts ...Option) error {
|
|
|
|
for _, o := range opts {
|
|
|
|
o(&n.opts)
|
|
|
|
}
|
2020-09-10 00:06:29 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-11-03 01:57:11 +03:00
|
|
|
// Start starts new span
|
|
|
|
func (n *noopTracer) Start(ctx context.Context, name string) (context.Context, *Span) {
|
2020-09-10 00:06:29 +03:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2020-11-03 01:57:11 +03:00
|
|
|
// Finish finishes span
|
|
|
|
func (n *noopTracer) Finish(*Span) error {
|
2020-09-10 00:06:29 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-11-03 01:57:11 +03:00
|
|
|
// Read reads span
|
|
|
|
func (n *noopTracer) Read(...ReadOption) ([]*Span, error) {
|
2020-09-10 00:06:29 +03:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2020-11-03 01:57:11 +03:00
|
|
|
// NewTracer returns new noop tracer
|
2020-10-16 09:38:57 +03:00
|
|
|
func NewTracer(opts ...Option) Tracer {
|
2020-11-03 01:57:11 +03:00
|
|
|
return &noopTracer{opts: NewOptions(opts...)}
|
2020-09-10 00:06:29 +03:00
|
|
|
}
|