zipkin-js
zipkin-js copied to clipboard
Express instrumentation support for Stackdriver Trace
I hooked up the Zipkin collector that forwards tracing to Stackdriver Trace (as described here).
I am currently playing with the (very helpful) JS example , and I find that the traces that Stackdriver picks up has some misplaced or missing information:
The HTTP method column is empty and the URI displays the method.
It looks like it stems from this line in the Express middleware: https://github.com/openzipkin/zipkin-js/blob/master/packages/zipkin-instrumentation-express/src/expressMiddleware.js#L31
And then here: https://github.com/openzipkin/zipkin-js/blob/master/packages/zipkin/src/instrumentation/httpClient.js#L19
The method is passed as the first parameter in the middleware, but seems to be expected as the third parameter?
What is the best practice for me to configure how traces are built and sent? Should I roll my own middleware based on the Express middleware? I am not using the Zipkin UI to consume the information, just the Stackdriver Trace.
Please advice.
one way is to implement something like we have in brave, which is a generic http data policy thing. this would allow you to change the span name etc.
https://github.com/openzipkin/brave/tree/master/instrumentation/http#span-data-policy
Note that the converter indeed uses the same name as we do https://github.com/GoogleCloudPlatform/stackdriver-zipkin/blob/master/translation/src/main/java/com/google/cloud/trace/zipkin/translation/SpanTranslator.java#L65
however, there's a pending PR to update to their new Api, so that should be merged before looking at data more carefully https://github.com/GoogleCloudPlatform/stackdriver-zipkin/pull/50