4
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.mod
									
									
									
									
									
								
							| @@ -1,11 +1,11 @@ | ||||
| module go.unistack.org/micro-tracer-instana/v4 | ||||
| module go.unistack.org/micro-tracer-instana/v3 | ||||
|  | ||||
| go 1.20 | ||||
|  | ||||
| require ( | ||||
| 	github.com/instana/go-sensor v1.55.2 | ||||
| 	github.com/opentracing/opentracing-go v1.2.0 | ||||
| 	go.unistack.org/micro/v4 v4.0.7 | ||||
| 	go.unistack.org/micro/v3 v3.10.25 | ||||
| ) | ||||
|  | ||||
| require ( | ||||
|   | ||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO | ||||
| github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= | ||||
| github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= | ||||
| github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= | ||||
| go.unistack.org/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM= | ||||
| go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= | ||||
| go.unistack.org/micro/v3 v3.10.25 h1:A0epdZHOqjnXx103wwFhPKgmvVVbScvfbmn3HmHz1wE= | ||||
| go.unistack.org/micro/v3 v3.10.25/go.mod h1:ALkeXpqChYDjx8KPi7tz9mmIyOnob6nlNswsg8BnZjQ= | ||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||
| gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||
| gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||||
|   | ||||
							
								
								
									
										15
									
								
								instana.go
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								instana.go
									
									
									
									
									
								
							| @@ -6,9 +6,8 @@ import ( | ||||
| 	sensor "github.com/instana/go-sensor" | ||||
| 	"github.com/opentracing/opentracing-go" | ||||
| 	"github.com/opentracing/opentracing-go/log" | ||||
| 	"go.unistack.org/micro/v4/metadata" | ||||
| 	"go.unistack.org/micro/v4/options" | ||||
| 	"go.unistack.org/micro/v4/tracer" | ||||
| 	"go.unistack.org/micro/v3/metadata" | ||||
| 	"go.unistack.org/micro/v3/tracer" | ||||
| ) | ||||
|  | ||||
| var _ tracer.Tracer = &Tracer{} | ||||
| @@ -26,7 +25,7 @@ func (ot *Tracer) Flush(ctx context.Context) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (ot *Tracer) Init(opts ...options.Option) error { | ||||
| func (ot *Tracer) Init(opts ...tracer.Option) error { | ||||
| 	for _, o := range opts { | ||||
| 		o(&ot.opts) | ||||
| 	} | ||||
| @@ -41,7 +40,7 @@ func (ot *Tracer) Init(opts ...options.Option) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (ot *Tracer) Start(ctx context.Context, name string, opts ...options.Option) (context.Context, tracer.Span) { | ||||
| func (ot *Tracer) Start(ctx context.Context, name string, opts ...tracer.SpanOption) (context.Context, tracer.Span) { | ||||
| 	options := tracer.NewSpanOptions(opts...) | ||||
| 	var span opentracing.Span | ||||
| 	switch options.Kind { | ||||
| @@ -81,14 +80,14 @@ func (os *otSpan) Tracer() tracer.Tracer { | ||||
| 	return &Tracer{sensor: os.sensor, opts: os.topts} | ||||
| } | ||||
|  | ||||
| func (os *otSpan) Finish(opts ...options.Option) { | ||||
| func (os *otSpan) Finish(opts ...tracer.SpanOption) { | ||||
| 	if len(os.opts.Labels) > 0 { | ||||
| 		os.span.LogKV(os.opts.Labels...) | ||||
| 	} | ||||
| 	os.span.Finish() | ||||
| } | ||||
|  | ||||
| func (os *otSpan) AddEvent(name string, opts ...options.Option) { | ||||
| func (os *otSpan) AddEvent(name string, opts ...tracer.EventOption) { | ||||
| 	os.span.LogFields(log.Event(name)) | ||||
| } | ||||
|  | ||||
| @@ -112,7 +111,7 @@ func (os *otSpan) AddLabels(labels ...interface{}) { | ||||
| 	os.opts.Labels = append(os.opts.Labels, labels...) | ||||
| } | ||||
|  | ||||
| func NewTracer(opts ...options.Option) *Tracer { | ||||
| func NewTracer(opts ...tracer.Option) *Tracer { | ||||
| 	options := tracer.NewOptions(opts...) | ||||
| 	return &Tracer{opts: options} | ||||
| } | ||||
|   | ||||
| @@ -2,11 +2,11 @@ package instana | ||||
|  | ||||
| import ( | ||||
| 	sensor "github.com/instana/go-sensor" | ||||
| 	"go.unistack.org/micro/v4/options" | ||||
| 	"go.unistack.org/micro/v3/tracer" | ||||
| ) | ||||
|  | ||||
| type tracerOptionsKey struct{} | ||||
|  | ||||
| func Options(opts *sensor.Options) options.Option { | ||||
| 	return options.ContextOption(tracerOptionsKey{}, opts) | ||||
| func Options(opts *sensor.Options) tracer.Option { | ||||
| 	return tracer.SetOption(tracerOptionsKey{}, opts) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user