in kong/plugins/skywalking/handler.lua [35:55]
function SkyWalkingHandler:access(config)
if subsystem == "stream" then
kong.log.warn("Not supportted to trace \"stream\" request yet.")
return
end
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
end