Skip to content
This repository has been archived by the owner on Nov 27, 2017. It is now read-only.

UI: Collecting Spans with no annotations crashes the UI #40

Open
codefromthecrypt opened this issue May 4, 2017 · 10 comments
Open

UI: Collecting Spans with no annotations crashes the UI #40

codefromthecrypt opened this issue May 4, 2017 · 10 comments

Comments

@codefromthecrypt
Copy link

From @rogeralsing on September 8, 2016 20:5

If you collect a root span with no annotations on (which is ofcourse incorrect) the UI breaks with a null reference exception at the find trace screen, and thus making it impossible to find any trace at all.

This is ofc an edgecase that souldnt occur, but if someone sends corrupt data to Zipkin, it would be nice if things continue to work as expected.

Copied from original issue: openzipkin/zipkin#1278

@codefromthecrypt
Copy link
Author

From @cburroughs on December 20, 2016 18:36

I'm unsure how to reproduce this. I tried synthesizing a trace with the root span:

  {
    "traceId": "1b0c8b7d5a4a4632a8462d044d2fffff",
    "id": "81d0a94237ae54de",
    "name": "foo",
    "timestamp": 1481324510534000,
    "duration": 21272000,
    "annotations": [
    ],
    "binaryAnnotations": [
    ]
  },

But did not get errors when searching for it.

@codefromthecrypt
Copy link
Author

in zipkin v1 we have to have at least one annotation or binary annotation as that's where the servicename is sourced from. If you could help with model v2 support we could get it in much quicker.. lemme know openzipkin/zipkin#939 (comment)

@codefromthecrypt
Copy link
Author

ps (does this literally crash or just doesn't show up?)

@codefromthecrypt
Copy link
Author

From @bkleef on May 3, 2017 14:4

@adriancole this is still the case with version 1.23.3. As you can see we only set binaryAnnotations possibly because we use https://github.com/openzipkin/zipkin-go-opentracing.

On browser console we get a JS error:

EXCEPTION: this.root.annotations is undefined

Response:

[
   [
      {
         "traceId":"414e44fb181df47e6ec3273cd5e68c13",
         "id":"48f69e22bceb3828",
         "name":"com.example.srv.time.transport.getlist",
         "timestamp":1493817271284756,
         "duration":10181,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.api.v1.time",
               "endpoint":{
                  "serviceName":"com.example.api.v1.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      },
      {
         "traceId":"414e44fb181df47e6ec3273cd5e68c13",
         "id":"7b6b5f79a727456e",
         "name":"com.example.srv.time.transport.getlist",
         "parentId":"48f69e22bceb3828",
         "timestamp":1493817271292233,
         "duration":1703,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.srv.time",
               "endpoint":{
                  "serviceName":"com.example.srv.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      }
   ],
   [
      {
         "traceId":"6022cde94bff790803ccfec040a020d6",
         "id":"62f37b8ddfb2c9d0",
         "name":"com.example.srv.time.transport.getlist",
         "timestamp":1493817222041547,
         "duration":12139,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.api.v1.time",
               "endpoint":{
                  "serviceName":"com.example.api.v1.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      },
      {
         "traceId":"6022cde94bff790803ccfec040a020d6",
         "id":"735f5fdd1cf20628",
         "name":"com.example.srv.time.transport.getlist",
         "parentId":"62f37b8ddfb2c9d0",
         "timestamp":1493817222050620,
         "duration":2124,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.srv.time",
               "endpoint":{
                  "serviceName":"com.example.srv.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      }
   ],
   [
      {
         "traceId":"70cdb97b817d2d5069da6015f1b58242",
         "id":"4824ed25b2ce7b68",
         "name":"com.example.srv.time.transport.getlist",
         "timestamp":1493817220184318,
         "duration":10554,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.api.v1.time",
               "endpoint":{
                  "serviceName":"com.example.api.v1.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      },
      {
         "traceId":"70cdb97b817d2d5069da6015f1b58242",
         "id":"427c20a173159005",
         "name":"com.example.srv.time.transport.getlist",
         "parentId":"4824ed25b2ce7b68",
         "timestamp":1493817220191750,
         "duration":2071,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.srv.time",
               "endpoint":{
                  "serviceName":"com.example.srv.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      }
   ],
   [
      {
         "traceId":"4633b79f27358e0a4a668a87dd6db8f6",
         "id":"5d0e401ceb6199b1",
         "name":"com.example.srv.time.transport.getlist",
         "timestamp":1493816987763840,
         "duration":17246,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.api.v1.time",
               "endpoint":{
                  "serviceName":"com.example.api.v1.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      },
      {
         "traceId":"4633b79f27358e0a4a668a87dd6db8f6",
         "id":"099b6f99a3d302fc",
         "name":"com.example.srv.time.transport.getlist",
         "parentId":"5d0e401ceb6199b1",
         "timestamp":1493816987773581,
         "duration":6534,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.srv.time",
               "endpoint":{
                  "serviceName":"com.example.srv.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      }
   ],
   [
      {
         "traceId":"77bd870f0f9937eb1921da490b61a621",
         "id":"42c74cfe6ff12b92",
         "name":"com.example.srv.time.transport.getlist",
         "timestamp":1493816987572696,
         "duration":11595,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.api.v1.time",
               "endpoint":{
                  "serviceName":"com.example.api.v1.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      },
      {
         "traceId":"77bd870f0f9937eb1921da490b61a621",
         "id":"34de313496a58702",
         "name":"com.example.srv.time.transport.getlist",
         "parentId":"42c74cfe6ff12b92",
         "timestamp":1493816987580616,
         "duration":2552,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.srv.time",
               "endpoint":{
                  "serviceName":"com.example.srv.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      }
   ],
   [
      {
         "traceId":"12c36c4ed14fd71520afcc13d5d4afc3",
         "id":"5351db552b8ef348",
         "name":"com.example.srv.time.transport.getlist",
         "timestamp":1493816984668362,
         "duration":17917,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.api.v1.time",
               "endpoint":{
                  "serviceName":"com.example.api.v1.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      },
      {
         "traceId":"12c36c4ed14fd71520afcc13d5d4afc3",
         "id":"4fa53a43d7320099",
         "name":"com.example.srv.time.transport.getlist",
         "parentId":"5351db552b8ef348",
         "timestamp":1493816984681105,
         "duration":3786,
         "binaryAnnotations":[
            {
               "key":"lc",
               "value":"com.example.srv.time",
               "endpoint":{
                  "serviceName":"com.example.srv.time",
                  "ipv4":"127.0.0.1"
               }
            }
         ],
         "debug":true
      }
   ]
]

@codefromthecrypt
Copy link
Author

From @basvanbeek on May 3, 2017 14:29

zipkin-go-opentracing does not force you to do binary annotations only.

If you want to annotate a span as a RPC client node calling some service, you should use: ext.SpanKindRPCClient.Set(span) on the span.

If you want to annotate a span as a RPC server node receiving an incoming request, you should extract the B3 headers propagating the client side span with tracer.Extract() after which you create the server side span feeding it the received wirecontext tracer.StartSpan("operationName", ext.RPCServerOption(wireContext)) which can be seen in the example middleware:
https://github.com/openzipkin/zipkin-go-opentracing/blob/master/examples/middleware/http.go#L74

If you are doing internal local component spans you can use the logic as seen here: https://github.com/openzipkin/zipkin-go-opentracing/blob/master/examples/cli_with_2_services/svc2/implementation.go#L53 where doing a timestamped LC annotation by invoking ext.SpanKind.Set(span, "resource") or do a span.LogEvent("lc") or span.LogEvent(zipkincore.LOCAL_COMPONENT) which is more native to Zipkin.

@codefromthecrypt
Copy link
Author

From @bkleef on May 3, 2017 16:19

@basvanbeek thanks a lot for your feedback. We will look into it.

IMHO it's still a bad thing that the new Zipkin UI crashes (only services are displayed in "Service" dropdown but no traces are shown while they are visualized in old UI) when annotations is missing in JSON response. Especially because old UI can handle this.

@codefromthecrypt
Copy link
Author

I was going to ask. Seems this issue wss opened on the wrong repository as
the new UI code is not here.

Moreover, we are looking to renovate the "old UI" because no one is
contributing to the angular one. If you know anyone who can help, do
mention.

On 4 May 2017 12:19 am, "Bart van Kleef" [email protected] wrote:

@basvanbeek https://github.com/basvanbeek thanks a lot for your
feedback. We will look into it.
IMHO it's still a bad thing that the new Zipkin UI crashes (only
services are displayed in "Service" dropdown but no traces are shown while
they are visualized in old UI) when annotations is missing in JSON
response. Especially because old UI can handle this.

https://camo.githubusercontent.com/cdf93e1e6377f9d5892996e07f3a7b43d5a72934/68747470733a2f2f7075752e73682f76456d4b6d2f633638653661363233632e706e67


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
openzipkin/zipkin#1278 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAD618RewGxvR9WIWGwZjtrAdGwJ4qjCks5r2KkZgaJpZM4J4ZR4
.

@codefromthecrypt
Copy link
Author

So there's logic in zipkin.ts which assumes there's at least one annotation:

ex.

this.name = this.root.annotations[1].endpoint.serviceName;
...
uniqueId += span.name + span.annotations[0].endpoint.serviceName;
...
span.children.sort((a, b) => a.annotations[0].timestamp - b.annotations[0].timestamp);

getting the default serviceName of a span could be done by duplicating code here: https://github.com/openzipkin/zipkin/blob/master/zipkin-ui/js/component_ui/traceSummary.js#L45
the ^^ code looks in both annotations and binary annotations and has priority logic. If this were moved here, make sure to move tests along with it and track drift.

Timestamp comparison should first use span.timestamp, then fallback to annotation.timestamp. In fact you'll rarely see no span.timestamp (as the query api derives it if absent)

@trtg
Copy link

trtg commented Jun 1, 2017

so what is the current state of the UI if we would like to contribute? Is the "old" UI the one to look at, or this one?

@codefromthecrypt
Copy link
Author

the bug is in this project (not in the bundled UI), so any change would happen here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants