move options to dedicated package
Some checks failed
lint / lint (pull_request) Failing after 1m31s
pr / test (pull_request) Failing after 2m37s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-07-29 00:40:58 +03:00
parent b1dbd99ce2
commit 6f6f850af6
84 changed files with 1154 additions and 4521 deletions

View File

@@ -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...),
}