spacewander commented on code in PR #8099:
URL: https://github.com/apache/apisix/pull/8099#discussion_r1000071567
##########
apisix/plugins/zipkin.lua:
##########
@@ -163,9 +165,9 @@ function _M.rewrite(plugin_conf, ctx)
-- pass the trace ids even the sample is rejected
-- see https://github.com/openzipkin/b3-propagation#why-send-
-- trace-ids-with-a-reject-sampling-decision
- core.request.set_header(ctx, "x-b3-traceid", trace_id)
- core.request.set_header(ctx, "x-b3-parentspanid", parent_span_id)
- core.request.set_header(ctx, "x-b3-spanid", request_span_id)
+ core.request.set_header(ctx, "x-b3-traceid", trace_id or
to_hex(rand_bytes(16)))
Review Comment:
There is no standard way to do sampling in zipkin. But by reading the code
of Kong / Envoy / Traefik, they both choose the "correct steps" we described in
https://github.com/apache/apisix/pull/8099#discussion_r999020747.
The benefit of this way is that we don't need to duplicate header set
operations in both sampling and no sampling path, especially when we need to
introduce more flags in the future. The fake span id solution is not so popular.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]