From 908e196df463dad49596a7e3e77f08002a1cf17a Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 19 Jul 2019 21:51:13 +0800 Subject: [PATCH 1/3] fix zipkin servicename --- pkg/net/trace/span.go | 6 +++++- pkg/net/trace/zipkin/zipkin.go | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/net/trace/span.go b/pkg/net/trace/span.go index 635785f69..4715a301d 100644 --- a/pkg/net/trace/span.go +++ b/pkg/net/trace/span.go @@ -27,7 +27,11 @@ type Span struct { childs int } -func (s *Span) Name() string { +func (s *Span) ServiceName() string { + return s.operationName +} + +func (s *Span) OperationName() string { return s.operationName } diff --git a/pkg/net/trace/zipkin/zipkin.go b/pkg/net/trace/zipkin/zipkin.go index db6e1737f..aff0fa6c4 100644 --- a/pkg/net/trace/zipkin/zipkin.go +++ b/pkg/net/trace/zipkin/zipkin.go @@ -37,11 +37,12 @@ func (r *report) WriteSpan(raw *trace.Span) (err error) { ID: spanID, ParentID: &parentID, }, - Name: raw.Name(), + Name: raw.OperationName(), Timestamp: raw.StartTime(), Duration: raw.Duration(), Tags: make(map[string]string, len(tags)+len(logs)), } + span.LocalEndpoint = &model.Endpoint{ServiceName: raw.ServiceName()} for _, tag := range tags { switch tag.Key { case trace.TagSpanKind: @@ -55,8 +56,6 @@ func (r *report) WriteSpan(raw *trace.Span) (err error) { case "consumer": span.Kind = model.Consumer } - case trace.TagPeerService: - span.LocalEndpoint = &model.Endpoint{ServiceName: tag.Value.(string)} default: v, ok := tag.Value.(string) if ok { From 0cf5edb4558188f28b4cd2fc3c670b542d1f564b Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 19 Jul 2019 21:59:00 +0800 Subject: [PATCH 2/3] fix zipkin name --- pkg/net/trace/span.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/net/trace/span.go b/pkg/net/trace/span.go index 4715a301d..ef349beff 100644 --- a/pkg/net/trace/span.go +++ b/pkg/net/trace/span.go @@ -28,7 +28,7 @@ type Span struct { } func (s *Span) ServiceName() string { - return s.operationName + return s.dapper.serviceName } func (s *Span) OperationName() string { From cef5fa8fe35f0395051bd0a49cbff0fdf995532d Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 19 Jul 2019 22:28:10 +0800 Subject: [PATCH 3/3] release v0.2.0 --- tool/kratos/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/kratos/template.go b/tool/kratos/template.go index 14305397c..ce8df9d1a 100644 --- a/tool/kratos/template.go +++ b/tool/kratos/template.go @@ -547,7 +547,7 @@ type Kratos struct { go 1.12 require ( - github.com/bilibili/kratos v0.1.0 + github.com/bilibili/kratos v0.2.0 github.com/gogo/protobuf v1.2.1 github.com/golang/protobuf v1.3.1 golang.org/x/net v0.0.0-20190420063019-afa5a82059c6