Feature request: abstraction for profile context

Bug #1807431 reported by Ken Giusti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
osprofiler
Confirmed
Undecided
Unassigned

Bug Description

Hi,

I'm working on a patch to oslo.messaging that will integrate osprofiler for tracing across RPC calls:

https://review.openstack.org/#/c/623254/

Ilya makes a good observation about accessing the current context:

https://review.openstack.org/#/c/623254/1/oslo_messaging/rpc/client.py@129

Ideally oslo.messaging shouldn't have to explicitly construct the components of osprofiler's context as I have done in the patch:

        # send profiler state to the server for tracing the RPC call
        if profiler:
            prof = profiler.get()
            if prof:
                msg['osprofiler'] = {
                    'hmac_key': prof.hmac_key,
                    'base_id': prof.get_base_id(),
                    'parent_id': prof.get_id()
                }

Instead the context should be opaque as far as oslo.messaging is concerned - osprofiler should provide it in the correct serialized form for including in the messages meta-data.

Would it be possible to provide a new profiler access method that returns a pre-built context as a map rather than have oslo.messaging pick out the values explicitly? Then oslo.messaging wouldn't care what's in the context. like this:

        # send profiler state to the server for tracing the RPC call
        if profiler:
            prof = profiler.get()
            if prof:
                msg['osprofiler'] = prof.get_context()

And on the server side we can easily set the state (as we do in the patch):

       ctxt = msg.get('osprofiler')
       if ctxt is not None:
           profiler.init(**ctxt)

Ilya Shakhat (shakhat)
Changed in osprofiler:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.