micro/tracer/noop.go
Vasiliy Tolstov d18bf3dab9 many fixes for lint and context.Context usage
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-03 01:57:11 +03:00

36 lines
648 B
Go

package tracer
import "context"
type noopTracer struct {
opts Options
}
// Init initilize tracer
func (n *noopTracer) Init(opts ...Option) error {
for _, o := range opts {
o(&n.opts)
}
return nil
}
// Start starts new span
func (n *noopTracer) Start(ctx context.Context, name string) (context.Context, *Span) {
return nil, nil
}
// Finish finishes span
func (n *noopTracer) Finish(*Span) error {
return nil
}
// Read reads span
func (n *noopTracer) Read(...ReadOption) ([]*Span, error) {
return nil, nil
}
// NewTracer returns new noop tracer
func NewTracer(opts ...Option) Tracer {
return &noopTracer{opts: NewOptions(opts...)}
}