- allow disable/enable of tracing in the "preRequest" context, by setting a request boolean flag from a lua script:
Request.Trace.Enable
by default, the flag should be set to true/false according to the global tracing configuration, and could be ovwerwritten to specific requests from the script.
- add event (=log) API:
Request.Trace.AddEvent(name)
name - string
- add attribute (=tag) API:
Request.Trace.SetAttribute(key, value)
key - must be string
value - should support any basic lua type
adding events and attributes could be done in "postRequest" context as well
- need to make sure that the lua script is invoked after the span was created and added to req_state in "rgw_process.cc"
- a new metatable "Trace" should be added to "rgw_lua_request.cc"
- this table should one boolean writeable fiels "Enable"
- as well as the 2 new functions: "AddEvent" and "SetAttribute"
- need some investigation on the multi-type support for the value in "SetAttribute"
- this is an example on how to create a function and bind it to a C++ function: https://github.com/ceph/ceph/blob/master/src/rgw/rgw_lua_utils.cc#L19
- note that the above is a "standalone" function with parameters. however, in our case we need these functions to belong to a table. this is an example on how to attach a function to a table: https://github.com/ceph/ceph/blob/master/src/rgw/rgw_lua_request.cc#L813-L821