Lua implementation of the OpenTracing API http://opentracing.io
In order to understand the Lua platform API, one must first be familiar with the OpenTracing project and terminology more generally.
Everyday consumers of this opentracing
package really only need to worry
about a couple of key abstractions: the start_span
function, the Span
interface, and binding a Tracer
at initialization-time. Here are code snippets
demonstrating some important use cases.
It's always possible to create a "root" Span
with no parent or other causal
reference.
function xyz()
...
tracer = --[[ Some Tracer ]]
span = tracer:start_span("operation_name")
-- Do some work
span:finish()
...
end
function qrz(parent_span)
...
tracer = --[[ Some Tracer ]]
span = tracer:start_span(
"operation_name",
{["references"] = {{"child_of", parent_span:context()}}})
-- Do some work
span:finish()
...
end
tracer = --[[ Some Tracer ]]
carrier = {}
span = tracer:start_span('abc')
tracer:http_headers_inject(span:context(), carrier)
tracer = --[[ Some Tracer ]]
carrier = --[[ Some carrier ]]
span_context = tracer:http_headers_extract(carrier)
For the time being, "mild" backwards-incompatible changes may be made without
changing the major version number. As OpenTracing and opentracing-cpp
mature,
backwards compatibility will become more of a priority.
By contributing to opentracing.lua, you agree that your contributions will be licensed under its Apache 2.0 License.