From 66d0607dd0780209cf9f280217d42b739286b187 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Fri, 9 Jun 2017 11:45:18 +0200 Subject: [PATCH] Expose connection_string parameter into DevStack plugin With this patch the user can select which OSProfiler driver to use in DevStack. The configuration parameter is `OSPROFILER_CONNECTION_STRING`. Default empty value refers to Ceilometer-based driver (value `messaging://`). DevStack plugin's README is updated to explain new option. Change-Id: I608cd3e7bafd29db72e9e3e4cb8eb7437cd81ab2 --- devstack/README.rst | 42 +++++++++++++++++++++++++++++++++-------- devstack/lib/osprofiler | 1 + devstack/settings | 1 + 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/devstack/README.rst b/devstack/README.rst index 31c3f11..9e5b752 100644 --- a/devstack/README.rst +++ b/devstack/README.rst @@ -5,24 +5,50 @@ Enabling OSProfiler using DevStack This directory contains the files necessary to run OpenStack with enabled OSProfiler in DevStack. -To configure DevStack to enable OSProfiler edit -``${DEVSTACK_DIR}/local.conf`` file and add:: +OSProfiler has different drivers for trace processing. The default driver uses +Ceilometer to process and store trace events. Other drivers may connect +to databases directly and do not require Ceilometer. + +To configure DevStack and enable OSProfiler edit ``${DEVSTACK_DIR}/local.conf`` +file and add the following to ``[[local|localrc]]`` section: + + * to use specified driver:: + + enable_plugin osprofiler https://git.openstack.org/openstack/osprofiler master + OSPROFILER_CONNECTION_STRING= + + the driver is chosen depending on the value of + ``OSPROFILER_CONNECTION_STRING`` variable (refer to the next section for + details) + + * to use default Ceilometer driver:: enable_plugin panko https://git.openstack.org/openstack/panko master enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer master enable_plugin osprofiler https://git.openstack.org/openstack/osprofiler master -to the ``[[local|localrc]]`` section. + .. note:: The order of enabling plugins matters. -One can also configure a set of HMAC secrets, that are used for triggering of -profiling in OpenStack services: only the requests that specify one of these +Run DevStack as normal:: + + $ ./stack.sh + + +Config variables +---------------- + +**OSPROFILER_HMAC_KEYS** - a set of HMAC secrets, that are used for triggering +of profiling in OpenStack services: only the requests that specify one of these keys in HTTP headers will be profiled. E.g. multiple secrets are specified as a comma-separated list of string values:: OSPROFILER_HMAC_KEYS=swordfish,foxtrot,charlie -.. note:: The order of enabling plugins matter. +**OSPROFILER_CONNECTION_STRING** - connection string to identify the driver. +Default value is ``messaging://`` refers to Ceilometer driver. For a full +list of drivers please refer to +``http://git.openstack.org/cgit/openstack/osprofiler/tree/osprofiler/drivers``. +Example: enable ElasticSearch driver with the server running on localhost:: -Run DevStack as normal:: + OSPROFILER_CONNECTION_STRING=elasticsearch://127.0.0.1:9200 - $ ./stack.sh diff --git a/devstack/lib/osprofiler b/devstack/lib/osprofiler index 5a5e72f..dbbebd4 100644 --- a/devstack/lib/osprofiler +++ b/devstack/lib/osprofiler @@ -53,6 +53,7 @@ function configure_osprofiler() { iniset $conf profiler enabled True iniset $conf profiler trace_sqlalchemy True iniset $conf profiler hmac_keys $OSPROFILER_HMAC_KEYS + iniset $conf profiler connection_string $OSPROFILER_CONNECTION_STRING fi done if [ -f $CEILOMETER_CONF ] diff --git a/devstack/settings b/devstack/settings index ac689c9..fea08c2 100644 --- a/devstack/settings +++ b/devstack/settings @@ -4,5 +4,6 @@ # of profiling in OpenStack services: profiling is only performed for # requests that specify one of these keys in HTTP headers. OSPROFILER_HMAC_KEYS=${OSPROFILER_HMAC_KEYS:-"SECRET_KEY"} +OSPROFILER_CONNECTION_STRING=${OSPROFILER_CONNECTION_STRING:-"messaging://"} enable_service osprofiler