Compare commits

..

8 Commits

Author SHA1 Message Date
c2f6dfd267 Merge pull request 'uniq labels' (#45) from imp into master
Some checks failed
build / test (push) Failing after 1m28s
build / lint (push) Failing after 2m44s
codeql / analyze (go) (push) Failing after 3m12s
Reviewed-on: #45
2023-09-01 15:52:53 +03:00
acd0034624 uniq labels
Some checks failed
automerge / automerge (pull_request) Failing after 4s
codeql / analyze (go) (pull_request) Failing after 3m4s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m28s
prbuild / lint (pull_request) Failing after 2m46s
autoapprove / autoapprove (pull_request) Failing after 1m25s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-09-01 15:52:29 +03:00
b32b60d136 fixup span and tags
Some checks failed
build / test (push) Failing after 1m29s
build / lint (push) Failing after 2m42s
codeql / analyze (go) (push) Failing after 3m14s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-09-01 08:27:53 +03:00
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 20 additions and 27 deletions

6
go.mod
View File

@@ -1,10 +1,10 @@
module go.unistack.org/micro-tracer-opentracing/v3 module go.unistack.org/micro-tracer-opentracing/v4
go 1.20 go 1.20
require ( require (
github.com/opentracing/opentracing-go v1.2.0 github.com/opentracing/opentracing-go v1.2.0
go.unistack.org/micro/v3 v3.10.27 go.unistack.org/micro/v4 v4.0.10
) )
require github.com/stretchr/testify v1.8.1 // indirect require github.com/stretchr/testify v1.8.3 // indirect

16
go.sum
View File

@@ -1,21 +1,13 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= 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/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= go.unistack.org/micro/v4 v4.0.10 h1:uKqED/n/zrJd4NGxm9OOUw26UMibgYFhf89MOTnM1go=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.unistack.org/micro/v4 v4.0.10/go.mod h1:QT3gOIE4qGgBiQGm2Pad/62Sl5R53QfrgYHD448aX14=
go.unistack.org/micro/v3 v3.10.27 h1:jluDdhkG9P/nchaNlhLkBmGxUASkV/L+/fuWG5RX1tY=
go.unistack.org/micro/v3 v3.10.27/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= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -7,8 +7,9 @@ import (
ot "github.com/opentracing/opentracing-go" ot "github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log" otlog "github.com/opentracing/opentracing-go/log"
"go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v4/metadata"
"go.unistack.org/micro/v3/tracer" "go.unistack.org/micro/v4/options"
"go.unistack.org/micro/v4/tracer"
) )
var _ tracer.Tracer = &otTracer{} var _ tracer.Tracer = &otTracer{}
@@ -26,7 +27,7 @@ func (t *otTracer) Flush(ctx context.Context) error {
return nil return nil
} }
func (t *otTracer) Init(opts ...tracer.Option) error { func (t *otTracer) Init(opts ...options.Option) error {
for _, o := range opts { for _, o := range opts {
o(&t.opts) o(&t.opts)
} }
@@ -40,7 +41,7 @@ func (t *otTracer) Init(opts ...tracer.Option) error {
return nil return nil
} }
func (t *otTracer) Start(ctx context.Context, name string, opts ...tracer.SpanOption) (context.Context, tracer.Span) { func (t *otTracer) Start(ctx context.Context, name string, opts ...options.Option) (context.Context, tracer.Span) {
options := tracer.NewSpanOptions(opts...) options := tracer.NewSpanOptions(opts...)
var span ot.Span var span ot.Span
switch options.Kind { switch options.Kind {
@@ -77,7 +78,7 @@ func (os *otSpan) Tracer() tracer.Tracer {
return &otTracer{tracer: os.span.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)%2 != 0 { if len(os.opts.Labels)%2 != 0 {
os.opts.Labels = os.opts.Labels[:len(os.opts.Labels)-1] os.opts.Labels = os.opts.Labels[:len(os.opts.Labels)-1]
} }
@@ -107,7 +108,7 @@ func (os *otSpan) Finish(opts ...tracer.SpanOption) {
os.span.Finish() os.span.Finish()
} }
func (os *otSpan) AddEvent(name string, opts ...tracer.EventOption) { func (os *otSpan) AddEvent(name string, opts ...options.Option) {
os.span.LogFields(otlog.Event(name)) os.span.LogFields(otlog.Event(name))
} }
@@ -131,7 +132,7 @@ func (os *otSpan) AddLabels(labels ...interface{}) {
os.opts.Labels = append(os.opts.Labels, labels...) os.opts.Labels = append(os.opts.Labels, labels...)
} }
func NewTracer(opts ...tracer.Option) *otTracer { func NewTracer(opts ...options.Option) *otTracer {
options := tracer.NewOptions(opts...) options := tracer.NewOptions(opts...)
return &otTracer{opts: options} return &otTracer{opts: options}
} }

View File

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

View File

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