Skip to content

Commit

Permalink
Merge branch 'master' into PR3319
Browse files Browse the repository at this point in the history
  • Loading branch information
albertteoh authored Oct 14, 2021
2 parents f0f744b + 51ce980 commit 7199205
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 16 deletions.
23 changes: 23 additions & 0 deletions cmd/collector/app/zipkin/fixtures/zipkin_03.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"traceId": "091f00370361e578",
"parentId": "c26551047c72d19",
"id": "188bb8428fc7e477",
"kind": "PRODUCER",
"name": "send",
"timestamp": 1597704629675602,
"duration": 9550570,
"localEndpoint":
{
"serviceName": "schemas-service"
},
"remoteEndpoint":
{
"serviceName": "kafka"
},
"tags":
{
"kafka.topic": "schema-changed"
}
}
]
52 changes: 50 additions & 2 deletions cmd/collector/app/zipkin/jsonv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
package zipkin

import (
"fmt"
"os"
"testing"

"github.com/go-openapi/swag"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/model/converter/thrift/zipkin"
"github.com/jaegertracing/jaeger/swagger-gen/models"
"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
)
Expand Down Expand Up @@ -54,7 +55,6 @@ func TestLCFromLocalEndpoint(t *testing.T) {
var spans models.ListOfSpans
loadJSON(t, "fixtures/zipkin_02.json", &spans)
tSpans, err := spansV2ToThrift(spans)
fmt.Println(tSpans[0])
require.NoError(t, err)
assert.Equal(t, len(tSpans), 1)
var ts int64 = 1
Expand All @@ -67,6 +67,54 @@ func TestLCFromLocalEndpoint(t *testing.T) {
assert.Equal(t, tSpan, tSpans[0])
}

func TestMissingKafkaEndpoint(t *testing.T) {
var spans models.ListOfSpans
loadJSON(t, "fixtures/zipkin_03.json", &spans)
tSpans, err := spansV2ToThrift(spans)
require.NoError(t, err)
assert.Equal(t, 1, len(tSpans))
var ts int64 = 1597704629675602
var d int64 = 9550570
var parentId int64 = 0xc26551047c72d19
var endpoint1 = zipkincore.Endpoint{ServiceName: "schemas-service"}
var endpoint2 = zipkincore.Endpoint{ServiceName: "schemas-service"}
var endpoint3 = zipkincore.Endpoint{ServiceName: "kafka"}

tSpan := &zipkincore.Span{ID: 0x188bb8428fc7e477, TraceID: 0x091f00370361e578, ParentID: &parentId,
Name: "send", Duration: &d, Timestamp: &ts,
Annotations: []*zipkincore.Annotation{
{
Host: &endpoint1,
Timestamp: ts,
Value: zipkincore.MESSAGE_SEND,
},
},
BinaryAnnotations: []*zipkincore.BinaryAnnotation{
{
Host: &endpoint2,
Key: "kafka.topic",
Value: []byte("schema-changed"),
AnnotationType: zipkincore.AnnotationType_STRING},
{

Key: zipkincore.MESSAGE_ADDR,
Host: &endpoint3,
AnnotationType: zipkincore.AnnotationType_BOOL,
},
},
}
assert.Equal(t, tSpan, tSpans[0])

tTags := []model.KeyValue{
{Key: "kafka.topic", VStr: "schema-changed"},
{Key: "peer.service", VStr: "kafka"},
}
var jaegerspan []*model.Span
jaegerspan, err = zipkin.ToDomainSpan(tSpans[0])
require.NoError(t, err)
assert.Equal(t, tTags, jaegerspan[0].GetTags())
}

func TestKindToThrift(t *testing.T) {
tests := []struct {
ts int64
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ require (
github.com/fsnotify/fsnotify v1.5.1
github.com/go-openapi/errors v0.20.1
github.com/go-openapi/loads v0.20.2
github.com/go-openapi/runtime v0.19.28
github.com/go-openapi/runtime v0.20.0
github.com/go-openapi/spec v0.20.4
github.com/go-openapi/strfmt v0.20.2
github.com/go-openapi/strfmt v0.20.3
github.com/go-openapi/swag v0.19.15
github.com/go-openapi/validate v0.20.2
github.com/go-openapi/validate v0.20.3
github.com/gocql/gocql v0.0.0-20200228163523-cd4b606dd2fb
github.com/gogo/googleapis v1.4.1
github.com/gogo/protobuf v1.3.2
Expand Down Expand Up @@ -48,7 +48,7 @@ require (
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
github.com/xdg-go/scram v1.0.2
go.opentelemetry.io/collector/model v0.36.0
go.opentelemetry.io/collector/model v0.37.0
go.uber.org/atomic v1.9.0
go.uber.org/automaxprocs v1.4.0
go.uber.org/zap v1.19.1
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29g
github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo=
github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98=
github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk=
github.com/go-openapi/runtime v0.19.28 h1:9lYu6axek8LJrVkMVViVirRcpoaCxXX7+sSvmizGVnA=
github.com/go-openapi/runtime v0.19.28/go.mod h1:BvrQtn6iVb2QmiVXRsFAm6ZCAZBpbVKFfN6QWCp582M=
github.com/go-openapi/runtime v0.20.0 h1:DEV4oYH28MqakaabtbxH0cjvlzFegi/15kfUVCfiZW0=
github.com/go-openapi/runtime v0.20.0/go.mod h1:2WnLRxMiOUWNN0UZskSkxW0+WXdfB1KmqRKCFH+ZWYk=
github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY=
Expand All @@ -276,8 +276,8 @@ github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk
github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk=
github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc=
github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc=
github.com/go-openapi/strfmt v0.20.2 h1:6XZL+fF4VZYFxKQGLAUB358hOrRh/wS51uWEtlONADE=
github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk=
github.com/go-openapi/strfmt v0.20.3 h1:YVG4ZgPZ00km/lRHrIf7c6cKL5/4FAUtG2T9RxWAgDY=
github.com/go-openapi/strfmt v0.20.3/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk=
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
Expand All @@ -296,8 +296,8 @@ github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbN
github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4=
github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI=
github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0=
github.com/go-openapi/validate v0.20.2 h1:AhqDegYV3J3iQkMPJSXkvzymHKMTw0BST3RK3hTT4ts=
github.com/go-openapi/validate v0.20.2/go.mod h1:e7OJoKNgd0twXZwIn0A43tHbvIcr/rZIVCbJBpTUoY0=
github.com/go-openapi/validate v0.20.3 h1:GZPPhhKSZrE8HjB4eEkoYAZmoWA4+tCemSgINH1/vKw=
github.com/go-openapi/validate v0.20.3/go.mod h1:goDdqVGiigM3jChcrYJxD2joalke3ZXeftD16byIjA4=
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
Expand Down Expand Up @@ -809,8 +809,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector/model v0.36.0 h1:5yxMNfmvPaJYCIT2o9ALkZ845YoBdbIbWxHv+p9FvaE=
go.opentelemetry.io/collector/model v0.36.0/go.mod h1:+7YCSjJG+MqiIFjauzt7oM2qkqBsaJWh5hcsO4fwsAc=
go.opentelemetry.io/collector/model v0.37.0 h1:K1G6bgzBZ5kKSjZ1+EY9MhCOYsac4Q1K85fBUgpTVH8=
go.opentelemetry.io/collector/model v0.37.0/go.mod h1:ESh1oWDNdS4fTg9sTFoYuiuvs8QuaX8yNGTPix3JZc8=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
Expand Down
2 changes: 1 addition & 1 deletion model/converter/thrift/zipkin/to_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (td toDomain) getTags(binAnnotations []*zipkincore.BinaryAnnotation, tagInc
value := string(annotation.Value)
tag := model.String(string(ext.Component), value)
retMe = append(retMe, tag)
case zipkincore.SERVER_ADDR, zipkincore.CLIENT_ADDR:
case zipkincore.SERVER_ADDR, zipkincore.CLIENT_ADDR, zipkincore.MESSAGE_ADDR:
retMe = td.getPeerTags(annotation.Host, retMe)
default:
tag, err := td.transformBinaryAnnotation(annotation)
Expand Down
3 changes: 2 additions & 1 deletion plugin/storage/badger/spanstore/read_write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"log"
"math/rand"
"os"
"path/filepath"
"runtime/pprof"
"testing"
"time"
Expand Down Expand Up @@ -614,7 +615,7 @@ func runLargeFactoryTest(tb testing.TB, test func(tb testing.TB, sw spanstore.Wr
opts := badger.NewOptions("badger")
v, command := config.Viperize(opts.AddFlags)

dir := "/mnt/ssd/badger/testRun"
dir := filepath.Join(tb.TempDir(), "badger-testRun")
err := os.MkdirAll(dir, 0700)
assert.NoError(err)
keyParam := fmt.Sprintf("--badger.directory-key=%s", dir)
Expand Down

0 comments on commit 7199205

Please sign in to comment.