-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect Zipkin v2 json #518
Conversation
008bc7d
to
dcdba0e
Compare
.gitmodules
Outdated
@@ -4,3 +4,6 @@ | |||
[submodule "jaeger-ui"] | |||
path = jaeger-ui | |||
url = https://github.com/uber/jaeger-ui | |||
[submodule "zipkin-api"] | |||
path = zipkin-api | |||
url = https://github.com/openzipkin/zipkin-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly are we getting from zipkin? I would rather do it without submodule dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's just one file we should simply copy it, similar to how we copy the thrift IDL file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only one file https://github.com/openzipkin/zipkin-api/blob/master/zipkin2-api.yaml The repo only contains API definitions: thrift and swagger.
I wanted to propose to use that also for zipkin.thrift
. Or we can just simply copy swagger to our idl. I don't have a strong preference. Zipkin submodule is easier to maintain. For example our zipkin thrift definition file slightly differs from upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to copy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
91e99be
to
ccb2cad
Compare
xdock tests with brave using JSON V2 are passing. It can be reviewed. In meanwhile I will improve coverage and wait for swagger a thrift IDL changes. |
cd795b5
to
102d6cf
Compare
102d6cf
to
8cd5aed
Compare
it's ready for review |
if err != nil { | ||
return nil, err | ||
} | ||
defer gz.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this close gz at the end of this function? looking at the tests, it looks like it works fine? hmmm
} | ||
|
||
// NewAPIHandler returns a new APIHandler | ||
func NewAPIHandler( | ||
zipkinSpansHandler app.ZipkinSpansHandler, | ||
) *APIHandler { | ||
) (*APIHandler, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function doesn't seem to return an error, is the API change necessary?
cmd/collector/app/zipkin/jsonv2.go
Outdated
"github.com/jaegertracing/jaeger/thrift-gen/zipkincore" | ||
) | ||
|
||
func spansV2ToThrift(spans *models.ListOfSpans) ([]*zipkincore.Span, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the pointer to the slice required? It doesn't look like you're doing anything to the slice reference in this function. Without the pointer, this function should be more readable
cmd/collector/app/zipkin/jsonv2.go
Outdated
return tSpans, nil | ||
} | ||
|
||
func spanV2ToThrift(s models.Span) (*zipkincore.Span, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when this function is invoked on L26, you already have a pointer to the span. Why not pass the pointer rather than making a copy of the span and passing that by value?
cmd/collector/app/zipkin/jsonv2.go
Outdated
} | ||
|
||
func annoV2ToThrift(a *models.Annotation, e *zipkincore.Endpoint) *zipkincore.Annotation { | ||
ta := &zipkincore.Annotation{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like you can inline return
cmd/collector/app/zipkin/jsonv2.go
Outdated
} | ||
|
||
func tagsToThrift(tags models.Tags, localE *zipkincore.Endpoint) []*zipkincore.BinaryAnnotation { | ||
var bAnnos []*zipkincore.BinaryAnnotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preallocate bAnnos to len(tags)
@@ -53,6 +54,14 @@ services: | |||
environment: | |||
- ENCODING=JSON | |||
|
|||
zipkin-brave-json-v2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 love how easy it is to integration test new endpoints
cmd/collector/app/zipkin/jsonv2.go
Outdated
) | ||
|
||
func spansV2ToThrift(spans models.ListOfSpans) ([]*zipkincore.Span, error) { | ||
var tSpans []*zipkincore.Span |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be preallocated too
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
90d3156
to
78db314
Compare
@yurishkuro I will merge on green, I can apply additional changes in a separate PR. |
Fixes #450
How does it work:
Zipkin related links:
messaging annos: openzipkin/zipkin-api#29
span v2: openzipkin/zipkin#1499