Compare commits

...

5 Commits

Author SHA1 Message Date
66d1c9d811 Merge pull request 'update for latest micro' (#41) from micro into master
Some checks failed
build / test (push) Failing after 1m29s
build / lint (push) Failing after 2m36s
codeql / analyze (go) (push) Failing after 3m13s
Reviewed-on: #41
2023-08-02 09:41:49 +03:00
a1838a8070 update for latest micro
Some checks failed
autoapprove / autoapprove (pull_request) Failing after 1m24s
automerge / automerge (pull_request) Failing after 3s
codeql / analyze (go) (pull_request) Failing after 3m11s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m28s
prbuild / lint (pull_request) Failing after 2m41s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-02 09:41:32 +03:00
9084c3134c Merge pull request 'move to micro v4' (#40) from v4 into master
Reviewed-on: #40
2023-05-07 19:39:06 +03:00
2fb5693d97 move to micro v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-05-07 19:38:45 +03:00
57e07c302c Merge branch 'v3' 2023-05-07 19:37:40 +03:00
5 changed files with 28 additions and 30 deletions

11
go.mod
View File

@@ -1,11 +1,10 @@
module go.unistack.org/micro-tracer-opentracing/v3
module go.unistack.org/micro-tracer-opentracing/v4
go 1.16
go 1.20
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/opentracing/opentracing-go v1.2.0
github.com/stretchr/testify v1.5.1 // indirect
go.unistack.org/micro/v3 v3.10.19
gopkg.in/yaml.v2 v2.4.0 // indirect
go.unistack.org/micro/v4 v4.0.5
)
require github.com/stretchr/testify v1.8.3 // indirect

20
go.sum
View File

@@ -1,21 +1,15 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
go.unistack.org/micro/v3 v3.10.19 h1:JtPacglETxHyb+GiuMdfxqGtnWSTYXPQm6PlDQfNIl8=
go.unistack.org/micro/v3 v3.10.19/go.mod h1:XIArw29f0b3uvF4cq96X/nQt2f0J2OGnjh8J+DBbC0s=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo=
go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs=
go.unistack.org/micro/v4 v4.0.5 h1:uacmV8yHjCOtVfECc4w1tgp6bd3bBWrZa8X4iQLk48g=
go.unistack.org/micro/v4 v4.0.5/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@@ -6,8 +6,9 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/log"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/tracer"
"go.unistack.org/micro/v4/metadata"
"go.unistack.org/micro/v4/options"
"go.unistack.org/micro/v4/tracer"
)
var _ tracer.Tracer = &otTracer{}
@@ -21,7 +22,11 @@ func (ot *otTracer) Name() string {
return ot.opts.Name
}
func (ot *otTracer) Init(opts ...tracer.Option) error {
func (ot *otTracer) Flush(ctx context.Context) error {
return nil
}
func (ot *otTracer) Init(opts ...options.Option) error {
for _, o := range opts {
o(&ot.opts)
}
@@ -35,7 +40,7 @@ func (ot *otTracer) Init(opts ...tracer.Option) error {
return nil
}
func (ot *otTracer) Start(ctx context.Context, name string, opts ...tracer.SpanOption) (context.Context, tracer.Span) {
func (ot *otTracer) Start(ctx context.Context, name string, opts ...options.Option) (context.Context, tracer.Span) {
options := tracer.NewSpanOptions(opts...)
var span opentracing.Span
switch options.Kind {
@@ -73,14 +78,14 @@ func (os *otSpan) Tracer() tracer.Tracer {
return &otTracer{tracer: os.span.Tracer()}
}
func (os *otSpan) Finish(opts ...tracer.SpanOption) {
func (os *otSpan) Finish(opts ...options.Option) {
if len(os.opts.Labels) > 0 {
os.span.LogKV(os.opts.Labels...)
}
os.span.Finish()
}
func (os *otSpan) AddEvent(name string, opts ...tracer.EventOption) {
func (os *otSpan) AddEvent(name string, opts ...options.Option) {
os.span.LogFields(log.Event(name))
}
@@ -104,7 +109,7 @@ func (os *otSpan) AddLabels(labels ...interface{}) {
os.opts.Labels = append(os.opts.Labels, labels...)
}
func NewTracer(opts ...tracer.Option) *otTracer {
func NewTracer(opts ...options.Option) *otTracer {
options := tracer.NewOptions(opts...)
return &otTracer{opts: options}
}

View File

@@ -6,7 +6,7 @@ import (
"testing"
opentracing "github.com/opentracing/opentracing-go"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v4/metadata"
)
func TestStartSpanFromIncomingContext(t *testing.T) {

View File

@@ -2,11 +2,11 @@ package opentracing
import (
"github.com/opentracing/opentracing-go"
"go.unistack.org/micro/v3/tracer"
"go.unistack.org/micro/v4/options"
)
type tracerKey struct{}
func Tracer(ot opentracing.Tracer) tracer.Option {
return tracer.SetOption(tracerKey{}, ot)
func Tracer(ot opentracing.Tracer) options.Option {
return options.ContextOption(tracerKey{}, ot)
}