You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/07/28 05:45:22 UTC
[GitHub] [skywalking] LL1024LL commented on issue #9397: [Bug] [Kong]report trace info not working
LL1024LL commented on issue #9397:
URL: https://github.com/apache/skywalking/issues/9397#issuecomment-1197691281
> This is not using ID=0 to initial, we expect ID=0 to report the trace. We have to pick one, otherwise, the trace would be reported repeatedly or face race conditions.
>
> My question would be, why don't you have a ID=0 worker?
Thank you for your reply !
I read the report process flow , and I think init work happends there.
[https://github.com/apache/skywalking-kong/blob/master/kong/plugins/skywalking/handler.lua#L44](https://github.com/apache/skywalking-kong/blob/master/kong/plugins/skywalking/handler.lua#L44)
```
if config.sample_ratio == 100 or math.random() * 100 < config.sample_ratio then
kong.ctx.plugin.skywalking_sample = true
if not client:isInitialized() then
local metadata_buffer = ngx.shared.tracing_buffer
metadata_buffer:set('serviceName', config.service_name)
metadata_buffer:set('serviceInstanceName', config.service_instance_name)
metadata_buffer:set('includeHostInEntrySpan', config.include_host_in_entry_span)
client:startBackendTimer(config.backend_http_uri)
end
tracer:start(self:get_remote_peer(ngx.ctx.balancer_data))
end
```
And when first worker(I think it is randomly) reach here, it will do initial work including call client:startBackendTimer.
But in client:startBackendTimer function
[https://github.com/apache/skywalking-nginx-lua/blob/master/lib/skywalking/client.lua#L33](https://github.com/apache/skywalking-nginx-lua/blob/master/lib/skywalking/client.lua#L33)
```
function Client:startBackendTimer(backend_http_uri)
initialized = true
```
The first thing the function do is set initialized = true.
So other worker will not enter Client:startBackendTimer function , including work-id = 0.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org