0

In the zipkin web ui, when the request url is http://10.19.138.169:9411/zipkin/api/v1/trace/ae60bd175a61e820

I find the return response is [ { "traceId": "ae60bd175a61e820", "id": "ae60bd175a61e820", "name": "client", "timestamp": 1511858133224433, "duration": 508444, "binaryAnnotations": [ { "key": "lc", "value": "", "endpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" } } ] }, { "traceId": "ae60bd175a61e820", "id": "19d69c3e93bc9040", "name": "post", "parentId": "ae60bd175a61e820", "timestamp": 1511858133239803, "duration": 490921, "annotations": [ { "timestamp": 1511858133239803, "value": "cs", "endpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133383290, "value": "sr", "endpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133609368, "value": "ss", "endpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133730724, "value": "cr", "endpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" } } ], "binaryAnnotations": [ { "key": "ca", "value": true, "endpoint": { "serviceName": "", "ipv4": "127.0.0.1", "port": 43928 } }, { "key": "http.path", "value": "/security/gateway", "endpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } }, { "key": "http.path", "value": "/security/gateway", "endpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" } }, { "key": "sa", "value": true, "endpoint": { "serviceName": "", "ipv4": "127.0.0.1", "port": 8090 } } ] }, { "traceId": "ae60bd175a61e820", "id": "16eefe087852af41", "name": "ennmonitorsecuritygatewayserver/put", "parentId": "19d69c3e93bc9040", "timestamp": 1511858133393425, "duration": 212916, "annotations": [ { "timestamp": 1511858133393425, "value": "cs", "endpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133588237, "value": "sr", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133593907, "value": "ss", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133606341, "value": "cr", "endpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } } ] }, { "traceId": "ae60bd175a61e820", "id": "8ef78f0edefe3a4b", "name": "data enqueue", "parentId": "16eefe087852af41", "timestamp": 1511858133592958, "duration": 129, "binaryAnnotations": [ { "key": "lc", "value": "", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } } ] }, { "traceId": "ae60bd175a61e820", "id": "97c637bcc891b86a", "name": "data dequeue, send to kafka", "parentId": "16eefe087852af41", "timestamp": 1511858133593147, "duration": 2416, "binaryAnnotations": [ { "key": "lc", "value": "", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } } ] }, { "traceId": "ae60bd175a61e820", "id": "f193c7f4193f2879", "name": "", "parentId": "16eefe087852af41", "timestamp": 1511858133594113, "duration": 7575, "annotations": [ { "timestamp": 1511858133594113, "value": "ms", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133601688, "value": "ws", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } } ], "binaryAnnotations": [ { "key": "kafka.topic", "value": "rdkafka", "endpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } } ] }, { "traceId": "ae60bd175a61e820", "id": "54a3f6268df0aaee", "name": "", "parentId": "f193c7f4193f2879", "timestamp": 1511858133600067, "duration": 5, "annotations": [ { "timestamp": 1511858133600067, "value": "wr", "endpoint": { "serviceName": "monitor-kafka-consumer", "ipv4": "10.19.138.169" } }, { "timestamp": 1511858133600072, "value": "mr", "endpoint": { "serviceName": "monitor-kafka-consumer", "ipv4": "10.19.138.169" } } ], "binaryAnnotations": [ { "key": "kafka.topic", "value": "rdkafka", "endpoint": { "serviceName": "monitor-kafka-consumer", "ipv4": "10.19.138.169" } } ] } ]

It can easy to find that there are 8 spans.

When I use the api to get the trace with the same traceId ElasticsearchStorage storage = ElasticsearchStorage.newBuilder() .hosts(Arrays.asList("http://10.19.138.169:9200")).build();

    List<Span> trace = null;
    try {
        trace = storage.spanStore().getTrace(traceId).execute();
    } catch (IOException e) {
        e.printStackTrace();
    }

I get [ { "traceId": "ae60bd175a61e820", "parentId": "16eefe087852af41", "id": "97c637bcc891b86a", "name": "data dequeue, send to kafka", "timestamp": 1511858133593147, "duration": 2416, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "id": "ae60bd175a61e820", "name": "client", "timestamp": 1511858133224433, "duration": 508444, "localEndpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "parentId": "f193c7f4193f2879", "id": "54a3f6268df0aaee", "kind": "CONSUMER", "timestamp": 1511858133600067, "duration": 5, "localEndpoint": { "serviceName": "monitor-kafka-consumer", "ipv4": "10.19.138.169" }, "tags": { "kafka.topic": "rdkafka" } }, { "traceId": "ae60bd175a61e820", "parentId": "ae60bd175a61e820", "id": "19d69c3e93bc9040", "kind": "SERVER", "name": "post", "timestamp": 1511858133383290, "duration": 226078, "localEndpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" }, "remoteEndpoint": { "ipv4": "127.0.0.1", "port": 43928 }, "tags": { "http.path": "/security/gateway" }, "shared": true }, { "traceId": "ae60bd175a61e820", "parentId": "19d69c3e93bc9040", "id": "16eefe087852af41", "kind": "CLIENT", "name": "ennmonitorsecuritygatewayserver/put", "timestamp": 1511858133393425, "duration": 212916, "localEndpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "parentId": "19d69c3e93bc9040", "id": "16eefe087852af41", "kind": "SERVER", "name": "ennmonitorsecuritygatewayserver/put", "timestamp": 1511858133588237, "duration": 5670, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" }, "shared": true }, { "traceId": "ae60bd175a61e820", "parentId": "16eefe087852af41", "id": "f193c7f4193f2879", "kind": "PRODUCER", "timestamp": 1511858133594113, "duration": 7575, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" }, "tags": { "kafka.topic": "rdkafka" } }, { "traceId": "ae60bd175a61e820", "parentId": "ae60bd175a61e820", "id": "19d69c3e93bc9040", "kind": "CLIENT", "name": "post", "timestamp": 1511858133239803, "duration": 490921, "localEndpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" }, "remoteEndpoint": { "ipv4": "127.0.0.1", "port": 8090 }, "tags": { "http.path": "/security/gateway" } }, { "traceId": "ae60bd175a61e820", "parentId": "ae60bd175a61e820", "id": "19d69c3e93bc9040", "kind": "SERVER", "name": "post", "timestamp": 1511858133383290, "duration": 226078, "localEndpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" }, "remoteEndpoint": { "ipv4": "127.0.0.1", "port": 43928 }, "tags": { "http.path": "/security/gateway" }, "shared": true }, { "traceId": "ae60bd175a61e820", "parentId": "19d69c3e93bc9040", "id": "16eefe087852af41", "kind": "SERVER", "name": "ennmonitorsecuritygatewayserver/put", "timestamp": 1511858133588237, "duration": 5670, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" }, "shared": true }, { "traceId": "ae60bd175a61e820", "parentId": "16eefe087852af41", "id": "97c637bcc891b86a", "name": "data dequeue, send to kafka", "timestamp": 1511858133593147, "duration": 2416, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "parentId": "16eefe087852af41", "id": "f193c7f4193f2879", "kind": "PRODUCER", "timestamp": 1511858133594113, "duration": 7575, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" }, "tags": { "kafka.topic": "rdkafka" } }, { "traceId": "ae60bd175a61e820", "parentId": "19d69c3e93bc9040", "id": "16eefe087852af41", "kind": "CLIENT", "name": "ennmonitorsecuritygatewayserver/put", "timestamp": 1511858133393425, "duration": 212916, "localEndpoint": { "serviceName": "monitor-gw-web", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "parentId": "ae60bd175a61e820", "id": "19d69c3e93bc9040", "kind": "CLIENT", "name": "post", "timestamp": 1511858133239803, "duration": 490921, "localEndpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" }, "remoteEndpoint": { "ipv4": "127.0.0.1", "port": 8090 }, "tags": { "http.path": "/security/gateway" } }, { "traceId": "ae60bd175a61e820", "id": "ae60bd175a61e820", "name": "client", "timestamp": 1511858133224433, "duration": 508444, "localEndpoint": { "serviceName": "monitor-gw-http-c", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "parentId": "f193c7f4193f2879", "id": "54a3f6268df0aaee", "kind": "CONSUMER", "timestamp": 1511858133600067, "duration": 5, "localEndpoint": { "serviceName": "monitor-kafka-consumer", "ipv4": "10.19.138.169" }, "tags": { "kafka.topic": "rdkafka" } }, { "traceId": "ae60bd175a61e820", "parentId": "16eefe087852af41", "id": "8ef78f0edefe3a4b", "name": "data enqueue", "timestamp": 1511858133592958, "duration": 129, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } }, { "traceId": "ae60bd175a61e820", "parentId": "16eefe087852af41", "id": "8ef78f0edefe3a4b", "name": "data enqueue", "timestamp": 1511858133592958, "duration": 129, "localEndpoint": { "serviceName": "monitor-gw-s", "ipv4": "10.19.138.169" } } ]

It is easy to find that there are 18 spans.

It seems that some of spans are merged in the web request, I want to know to where is the cource code deal this. Thanks!

wst_casd
  • 1
  • 1

1 Answers1

0

The first request uses v1 of the Zipkin api while the second uses v2 (see https://github.com/openzipkin/zipkin/issues/1499 for the v2 specification). Spans are broken up by kind (SERVER and CLIENT) instead of having client receive, server receive, client send, and server send annotations (hence why there are more spans).

Max Sindwani
  • 1,267
  • 7
  • 15