move options to dedicated package
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -2,6 +2,8 @@ package tracer
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.unistack.org/micro/v4/options"
|
||||
)
|
||||
|
||||
var _ Tracer = (*noopTracer)(nil)
|
||||
@@ -10,7 +12,7 @@ type noopTracer struct {
|
||||
opts Options
|
||||
}
|
||||
|
||||
func (t *noopTracer) Start(ctx context.Context, name string, opts ...SpanOption) (context.Context, Span) {
|
||||
func (t *noopTracer) Start(ctx context.Context, name string, opts ...options.Option) (context.Context, Span) {
|
||||
span := &noopSpan{
|
||||
name: name,
|
||||
ctx: ctx,
|
||||
@@ -27,7 +29,7 @@ func (t *noopTracer) Flush(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *noopTracer) Init(opts ...Option) error {
|
||||
func (t *noopTracer) Init(opts ...options.Option) error {
|
||||
for _, o := range opts {
|
||||
o(&t.opts)
|
||||
}
|
||||
@@ -47,7 +49,7 @@ type noopSpan struct {
|
||||
statusMsg string
|
||||
}
|
||||
|
||||
func (s *noopSpan) Finish(opts ...SpanOption) {
|
||||
func (s *noopSpan) Finish(opts ...options.Option) {
|
||||
}
|
||||
|
||||
func (s *noopSpan) Context() context.Context {
|
||||
@@ -58,7 +60,7 @@ func (s *noopSpan) Tracer() Tracer {
|
||||
return s.tracer
|
||||
}
|
||||
|
||||
func (s *noopSpan) AddEvent(name string, opts ...EventOption) {
|
||||
func (s *noopSpan) AddEvent(name string, opts ...options.Option) {
|
||||
}
|
||||
|
||||
func (s *noopSpan) SetName(name string) {
|
||||
@@ -87,7 +89,7 @@ func (s *noopSpan) SetStatus(st SpanStatus, msg string) {
|
||||
}
|
||||
|
||||
// NewTracer returns new memory tracer
|
||||
func NewTracer(opts ...Option) Tracer {
|
||||
func NewTracer(opts ...options.Option) Tracer {
|
||||
return &noopTracer{
|
||||
opts: NewOptions(opts...),
|
||||
}
|
||||
|
Reference in New Issue
Block a user