ironic/ironic/common
Ramamani Yeleswarapu 3773f17403 Enable OSProfiler support in Ironic
This patch does the following:
* Adds osprofiler wsgi middleware
  This middleware is used for 2 things:
  - It checks that person who wants to trace is trusted and knows
    secret HMAC key.
  - It starts tracing in case of proper trace headers
    and adds first wsgi trace point, with info about HTTP request.

* Adds initialization of osprofiler at start of service
  - Initialize and set an oslo.messaging based notifier instance
    to osprofiler, which will be used to send notifications to Ceilometer.

* Traces HTTP/RPC/DB API calls and SQL requests

NOTE to test this patch:
1) Make the following changes in localrc to configure DevStack to enable
   OSProfiler:

   enable_plugin panko https://git.openstack.org/openstack/panko
   enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer
   enable_plugin osprofiler https://git.openstack.org/openstack/osprofiler

   # Enable the following services
   CEILOMETER_NOTIFICATION_TOPICS=notifications,profiler
   ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral
   ENABLED_SERVICES+=,ceilometer-anotification,ceilometer-collector
   ENABLED_SERVICES+=,ceilometer-alarm-evaluator,ceilometer-alarm-notifier
   ENABLED_SERVICES+=,ceilometer-api

NOTE: the order of enabling plugins matters.

2) Run stack.sh. Once DevStack environment is setup, enable profiler options
   in ironic.conf and restart ironic services:
   [profiler]
   enabled = true
   hmac_keys = SECRET_KEY
   trace_sqlalchemy = true

3) Use openstackclient and run baremetal command with
   --os-profile SECRET_KEY
   [--profile can be used, but it is deprecated.]
   For example, the following will cause the <trace-id> to be printed
   after node list:

   $ openstack --os-profile SECRET_KEY baremetal node list
   .....
   .....
   Trace ID: <trace-id>
   Display trace with command:
   osprofiler trace show --html <trace-id>

4) The trace results can be saved using this command:

   $ osprofiler trace show --html <trace-id> --out trace.html

OSprofiler spec: https://review.openstack.org/#/c/103825/

Co-Authored-By: Tovin Seven <vinhnt@vn.fujitsu.com>
Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com>

Partial-Bug: #1560704

Change-Id: Icd3d7c62cf7442de8a77fc67f119ae9b03725f02
2017-07-07 15:58:28 -07:00
..
glance_service Refactor common keystone methods 2017-06-29 14:04:08 +03:00
__init__.py Remove copyright from empty files 2014-01-07 21:05:01 +08:00
boot_devices.py get_supported_boot_devices() returns static device list 2015-08-12 14:53:00 +01:00
cinder.py Refactor common keystone methods 2017-06-29 14:04:08 +03:00
config.py Enable OSProfiler support in Ironic 2017-07-07 15:58:28 -07:00
context.py Stop sending custom context values over RPC 2017-06-05 10:45:02 +00:00
dhcp_factory.py Remove file prefix parameter from lockutils methods 2016-11-28 13:29:01 +02:00
driver_factory.py Remove logging translation calls from ironic.common 2017-05-15 13:26:58 -04:00
exception.py Fetch Glance endpoint from Keystone if it's not provided in the configuration 2017-06-23 16:42:40 +02:00
fsm.py Removes unnecessary utf-8 encoding 2017-01-11 19:35:41 +05:30
grub_conf.template Fix for automated boot iso issue with IPA ramdisk 2015-04-10 09:09:53 -07:00
hash_ring.py Add hardware types to the hash ring 2017-01-19 20:35:05 +00:00
i18n.py doc: Add oslo.i18n usage link 2016-10-03 11:36:53 +00:00
image_service.py Refactor common keystone methods 2017-06-29 14:04:08 +03:00
images.py Add ldlinux.c32 to boot ISO for virtual media 2017-06-06 23:56:17 +09:00
isolinux_config.template Add support for creating vfat and iso images 2014-08-26 21:18:11 +05:30
keystone.py Refactor common keystone methods 2017-06-29 14:04:08 +03:00
network.py Validate portgroup physical network consistency 2017-06-15 15:03:10 -07:00
neutron.py Refactor common keystone methods 2017-06-29 14:04:08 +03:00
policy.py Add REST API for volume connector and volume target operation 2017-07-03 15:51:59 +09:00
profiler.py Enable OSProfiler support in Ironic 2017-07-07 15:58:28 -07:00
pxe_utils.py Deprecate elilo support 2017-05-29 11:47:54 -04:00
raid.py Add support for inband raid configuration agent ramdisk 2015-09-14 15:52:31 +00:00
release_mappings.py Move port object creation to conductor 2017-06-12 14:47:32 +01:00
rpc.py Enable OSProfiler support in Ironic 2017-07-07 15:58:28 -07:00
rpc_service.py Remove logging translation calls from ironic.common 2017-05-15 13:26:58 -04:00
service.py Make config generator aware of 'default_log_levels' override 2017-04-13 16:51:03 +03:00
states.py Generic power interface for soft reboot and soft power off 2017-01-04 11:38:01 +09:00
swift.py Refactor common keystone methods 2017-06-29 14:04:08 +03:00
utils.py Remove logging translation calls from ironic.common 2017-05-15 13:26:58 -04:00
wsgi_service.py Remove unused logging import 2017-02-17 08:28:28 +07:00