class decorator isn't enabled in nova for some service

Bug #1731864 reported by Matt Simonin on 2017-11-13
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Ilya Shakhat

Bug Description

* Observation:

When using devstack, nova-api rpc calls to the conductor (client side) aren't shown in the traces.

* Personnal Interpretation:

Nova osprofiler integration makes use of a wrapper around the class decorator[1]

This logic is executed at import time, the issue is that `CONF.profiler` options are set at run time when `config_parse` is called by the service (e.g in [2][3]).

In the nova-api case, setting a breakpoint in the wrapper we see that the decorator is executed when the `from nova import service` is loaded in the api command.

-> from nova.cmd.api import main
-> from nova import service
-> from nova import conductor
-> from nova.conductor import api as conductor_api
-> from nova.conductor import rpcapi
-> class ConductorAPI(object):
> /opt/stack/nova/nova/
-> if profiler and 'profiler' in CONF and CONF.profiler.enabled:

(Pdb) 'profiler' in CONF
(Pdb) CONF.profiler.enabled


Ilya Shakhat (shakhat) wrote :

Confirmed, the bug is introduced after switching to uWSGI-based deployment. Besides Nova it affects also Cinder. Keystone, Neutron and Heat are not affected.

Changed in osprofiler:
status: New → Confirmed
Matt Simonin (matthieu-simonin) wrote :

I took a look to old traces[1] (ocata - no uwsgi). If you take the first RPC in the trace (schedule_and_build_instances), you only get the receiver trace (the conductor) not the sender (the api). It's likely the issue was already here. They are also other cases in which you only get one of the two parts of the RPC (e.g see object_action compute->conductor when instance states are updated).

So my feeling is that it's not related to uwsgi but really rely on the fact that the test[2] is interpreted too early (at import time).


Ilya Shakhat (shakhat) wrote :

As I understand the RPC function `schedule_and_build_instances` is called from . Most probably it would be enough to add profiler.trace_cls decorator to the class ComputeTaskAPI.

The main problem here is that all instrumentation points are set manually and there's no guaranty of 100% coverage. More correct approach would be to instrument RPC library itself and catch all function calls.

Matt Simonin (matthieu-simonin) wrote :

I maybe missed something in the nova code base but I see it on the nova.conductor.rpcapi.ComputeTaskAPI:




Regarding the proposition to add it directly in oslo.messaging, I totally agree as this will catch all rpcs. But I don't think this will fix this particular issue (I'm still convince this is due to the wrapper evaluated at import time [1])


Matt Simonin (matthieu-simonin) wrote :

Just attached two traces obtained from the latest devstack deployment.
This focuses the test :

- test disabled: nova-boot-without-test.html
The trace shows 24 rpcs trace points

- test enabled: nova-boot-with-test.html
The trace shows 6 rpcs trace points instead of the 24 expected.

Disabling the test isn't probably a good solution since it will lead to patch the class regarless the osprofiler configuration.

Matt Riedemann (mriedem) wrote :
Changed in osprofiler:
status: Confirmed → In Progress
status: In Progress → Invalid
Changed in nova:
status: New → In Progress
assignee: nobody → Ilya Shakhat (shakhat)
importance: Undecided → Medium

Submitter: Zuul
Branch: master

commit 0b4608bf0b40d50834bd5ab2e50096ec6c284822
Author: Ilya Shakhat <email address hidden>
Date: Tue Nov 14 13:41:50 2017 +0100

    Initialize osprofiler in WSGI application

    This patch adds missing initialization of OSProfiler when
    Nova API is running as WSGI application.

    Change-Id: I779b144cfdfbe4a9a572990bad9720113402ac7f
    Related-Bug: #1731864

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers