function SkyWalkingHandler:body_filter()

in kong/plugins/skywalking/handler.lua [72:93]


function SkyWalkingHandler:body_filter(config)
    if ngx.arg[2] and kong.ctx.plugin.skywalking_sample then
        local entrySpan = ngx.ctx.entrySpan
        Span.tag(entrySpan, 'kong.node', kong.node.get_hostname())
        Span.setComponentId(entrySpan, 6001)

        local service = kong.router.get_service()
        if service and service.id then
            Span.tag(entrySpan, 'kong.service', service.id)
            local route = kong.router.get_route()
            if route and route.id then
                Span.tag(entrySpan, "kong.route", route.id)
            end
            if type(service.name) == "string" then
                Span.tag(entrySpan, "kong.service_name", service.name)
            end
        end
        Span.setComponentId(ngx.ctx.exitSpan, 6001)

        tracer:finish()
    end
end