openzipkin / zipkin-js

Zipkin instrumentation for Node.js and browsers
Apache License 2.0
564 stars 171 forks source link

What should be unique traces are all getting same traceId with the axios instrumentation #456

Open jeffthompson1971 opened 4 years ago

jeffthompson1971 commented 4 years ago

So all I'm doing is integrating at the axios level in ONE place. There is nothing downstream adding spans. This is simply ONE place where I've added axios (web-service call) instrumentation. In this instance this is a NestJS service (javascript of course) that polls the same endpoint every 30 seconds looking for notifications. So every 30 seconds it does

GET /api/v1/notifications

So what I expect is that every 30 seconds I have a brand new trace with a single span because i have no other instrumentation anywhere. So every web-service call is it's own trace.

But what I get is EVERY span is logged with the same traceId forever. So it seems there is like only one ID generated and used as a traceID from a single instrumentation point - and every single span logged from that instrumentation point will ONLY every have this one ID.

Then on top of that, every subsequent call, even though they are totally unrelated and distinct calls, the previous spanID is set as the parentID of the span... So ONE trace for every single call out of this service and one has a child, and he has a child and so on and on forever.

Here is the log of 3 spans being logged. You can see they all use same traceID somehow, and each spawns a child, even though these should all just be discrete traces - these spans have nothing to do with each other.

Can anyone explain a) why would every single flow through an instrumnation part reuse the traceID? b) what triggers the system to think that the previous span is the current's span's parent when they have no such relation?

[Nest] 83298 - 11/16/2019, 8:19:36 PM [ { "traceId": "39ac8b70786e7660", "parentId": "57bfbbd396033f90", "id": "5d3a212eef248142", "name": "get", "kind": "CLIENT", "timestamp": 1573957175933000, "duration": 209000, "localEndpoint": { "serviceName": "bis-app-web" }, "remoteEndpoint": { "serviceName": "hub-service" }, "tags": { "http.path": "/hub-api/notifications/all", "http.status_code": "200", } }, { "traceId": "39ac8b70786e7660", "parentId": "5d3a212eef248142", "id": "48146177b16174eb", "name": "get", "kind": "CLIENT", "timestamp": 1573957205931000, "duration": 223000, "localEndpoint": { "serviceName": "bis-app-web" }, "remoteEndpoint": { "serviceName": "hub-service" }, "tags": { "http.path": "/hub-api/notifications/all", "http.status_code": "200", } } { "traceId": "39ac8b70786e7660", "parentId": "48146177b16174eb", "id": "b75e403e79d0d1b7", "name": "get", "kind": "CLIENT", "timestamp": 1573957235240000, "duration": 180000, "localEndpoint": { "serviceName": "bis-app-web" }, "remoteEndpoint": { "serviceName": "hub-service" }, "tags": { "http.path": "/hub-api/notifications/all", "http.status_code": "200", } }

drazenbuljovcic commented 4 years ago

+1