shreemaan-abhishek opened a new pull request, #13656: URL: https://github.com/apache/apisix/pull/13656
### Description The zipkin plugin builds the request span with its full tags table (`http.method`, `http.url`, and the `get_remote_client_ip`/`get_remote_client_port` lookups) **before** deciding whether the request is sampled. But `apisix/plugins/zipkin/reporter.lua` drops any span whose `x-b3-sampled` baggage is `0`, so that per-request work is pure waste on unsampled requests. On high-throughput routes with a low `sample_ratio` this overhead is paid on every request. This PR: - Moves the sampling decision ahead of span construction. On unsampled requests the tags table and the two remote-addr lookups are skipped (`tags = nil`, which `opentracing` `start_span` handles cleanly). The bare span is still created because header propagation (`inject_header`) needs its trace context, and `set_ngx_var` output is unchanged. - Guards the span-version-1 child spans in the `access` phase behind `ctx.opentracing_sample` so unsampled requests skip those allocations too (also removes a latent nil-timestamp path). - Documents sampling as the primary performance lever for the zipkin and skywalking plugins. No behavior change for sampled requests: identical tags, span order, and `x-b3-sampled` propagation. ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change (existing zipkin tests cover sampled/unsampled propagation and set_ngx_var; all pass) - [x] I have updated the documentation to reflect this change - [x] I have verified that this change is backward compatible -- 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]
