Kong / opentracing-lua

Opentracing Library for Lua
Apache License 2.0
28 stars 9 forks source link

format and injectors #3

Open kakireddyp opened 3 years ago

kakireddyp commented 3 years ago

@james-callahan

Can you please provide sample code for injector. I'm trying to call inject as it needs format and it needs to be registered not sure about injector how to define that. any help here please

`local tracer = require("opentracing.tracer") local t = tracer:new() local span = t:start_span("hello-opentracing") local context = span:context()
local carrier = ngx.req.get_headers() span:set_tag("http.method", "GET") span:set_tag("http.url", "/hello-opentracing")

        t.register_injector("my_type","opentracing.tracer.injectors")
        t:inject(context,"my_type",carrier)
        --ngx.say(cjson.encode(context))`