Gallardot commented on code in PR #8099:
URL: https://github.com/apache/apisix/pull/8099#discussion_r998167475


##########
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:
   thanks, @spacewander 
   
   > For example, we don't have the ability to generate a root span. We require 
the client to pass a trace ID & span ID.
   
   APISIX has the ability to generate root spans, even if the client does not 
pass a trace ID & span ID. If we build such a simple route 
`curl->apisix->service`. We will find the root span generated by APISIX in the 
zipkin server.
   
   
   > Maybe we should add the ability to generate trace ID/span ID if not given 
instead of just generating a trace ID when the sampling is rejected
   
   It is better to have this ability, but it is the same as the current PR 
effect, only the logical difference in the processing process.



-- 
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]

Reply via email to