Collect Zipkin v2 json#518
Conversation
008bc7d to
dcdba0e
Compare
.gitmodules
Outdated
| 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.
What exactly are we getting from zipkin? I would rather do it without submodule dependency
There was a problem hiding this comment.
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.
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.
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.
won't this close gz at the end of this function? looking at the tests, it looks like it works fine? hmmm
| func NewAPIHandler( | ||
| zipkinSpansHandler app.ZipkinSpansHandler, | ||
| ) *APIHandler { | ||
| ) (*APIHandler, error) { |
There was a problem hiding this comment.
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.
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.
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.
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.
preallocate bAnnos to len(tags)
| environment: | ||
| - ENCODING=JSON | ||
|
|
||
| zipkin-brave-json-v2: |
There was a problem hiding this comment.
+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.
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