Support OSprofile usage

OSprofile allows user/devs trace OpenStack requests.

Implements: blueprint enable-osprofiler
Co-Authored-By: Bertrand Lallau <bertrand.lallau@gmail.com>
Change-Id: I82ea85d726011ef6cbf99380f395452d6d7f8053
This commit is contained in:
Eduardo Gonzalez 2017-04-10 15:31:41 +01:00 committed by Bertrand Lallau
parent 62972a6c8e
commit ab4b1ff785
22 changed files with 220 additions and 3 deletions

View File

@ -356,6 +356,7 @@ enable_neutron_bgp_dragent: "no"
enable_nova_serialconsole_proxy: "no" enable_nova_serialconsole_proxy: "no"
enable_octavia: "no" enable_octavia: "no"
enable_openvswitch: "{{ neutron_plugin_agent != 'linuxbridge' | bool }}" enable_openvswitch: "{{ neutron_plugin_agent != 'linuxbridge' | bool }}"
enable_osprofiler: "no"
enable_panko: "no" enable_panko: "no"
enable_rally: "no" enable_rally: "no"
enable_sahara: "no" enable_sahara: "no"
@ -393,7 +394,7 @@ enable_destroy_images: "no"
elasticsearch_address: "{{ kolla_internal_vip_address }}" elasticsearch_address: "{{ kolla_internal_vip_address }}"
elasticsearch_protocol: "{{ internal_protocol }}" elasticsearch_protocol: "{{ internal_protocol }}"
enable_elasticsearch: "{{ 'yes' if enable_central_logging | bool or enable_freezer | bool else 'no' }}" enable_elasticsearch: "{{ 'yes' if enable_central_logging | bool or enable_freezer | bool or enable_osprofiler | bool else 'no' }}"
enable_kibana: "{{ 'yes' if enable_central_logging | bool else 'no' }}" enable_kibana: "{{ 'yes' if enable_central_logging | bool else 'no' }}"
#################### ####################

View File

@ -152,3 +152,13 @@ hnas_svc0_hdp = {{ hnas_nfs_svc0_hdp }}
[privsep_entrypoint] [privsep_entrypoint]
helper_command=sudo cinder-rootwrap /etc/cinder/rootwrap.conf privsep-helper --config-file /etc/cinder/cinder.conf helper_command=sudo cinder-rootwrap /etc/cinder/rootwrap.conf privsep-helper --config-file /etc/cinder/cinder.conf
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -91,3 +91,13 @@ driver = messagingv2
{% else %} {% else %}
driver = noop driver = noop
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -50,3 +50,13 @@ driver = messagingv2
{% else %} {% else %}
driver = noop driver = noop
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -106,3 +106,13 @@ endpoint_type = publicURL
[oslo_middleware] [oslo_middleware]
enable_proxy_headers_parsing = True enable_proxy_headers_parsing = True
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -53,3 +53,13 @@ memcache_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansib
[oslo_messaging_notifications] [oslo_messaging_notifications]
driver = messagingv2 driver = messagingv2
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -76,3 +76,13 @@ topics = 'notifications'
{% else %} {% else %}
driver = noop driver = noop
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -40,3 +40,13 @@ url = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}
[oslo_messaging_notifications] [oslo_messaging_notifications]
driver = noop driver = noop
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -130,3 +130,13 @@ allow_reverse_dns_lookup = True
ipv4_ptr_zone_prefix_size = 24 ipv4_ptr_zone_prefix_size = 24
ipv6_ptr_zone_prefix_size = 116 ipv6_ptr_zone_prefix_size = 116
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -247,3 +247,13 @@ os_interface = internal
{% if enable_ceilometer | bool or enable_searchlight | bool or enable_designate | bool %} {% if enable_ceilometer | bool or enable_searchlight | bool or enable_designate | bool %}
notify_on_state_change = vm_and_task_state notify_on_state_change = vm_and_task_state
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -102,3 +102,15 @@ enabled = {{ enable_neutron | bool }}
[resource_plugin:os_neutron_security_group] [resource_plugin:os_neutron_security_group]
enabled = {{ enable_neutron | bool }} enabled = {{ enable_neutron | bool }}
{# TODO(blallau): enabling osprofiler when fixed in searchlight #}
{# {% if enable_osprofiler | bool %} #}
{# [profiler] #}
{# enabled = true #}
{# trace_sqlalchemy = true #}
{# hmac_keys = {{ osprofiler_secret }} #}
{# {% if enable_elasticsearch | bool %} #}
{# connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }} #}
{# {% endif %} #}
{# {% endif %} #}

View File

@ -50,3 +50,13 @@ topics = 'notifications'
{% else %} {% else %}
driver = noop driver = noop
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -11,3 +11,13 @@ transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}
[database] [database]
connection = mysql+pymysql://{{ trove_database_user }}:{{ trove_database_password }}@{{ trove_database_address }}/{{ trove_database_name }} connection = mysql+pymysql://{{ trove_database_user }}:{{ trove_database_password }}@{{ trove_database_address }}/{{ trove_database_name }}
max_retries = -1 max_retries = -1
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -32,3 +32,13 @@ topics = 'notifications'
{% else %} {% else %}
driver = noop driver = noop
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -43,3 +43,13 @@ topics = 'notifications'
{% else %} {% else %}
driver = noop driver = noop
{% endif %} {% endif %}
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -53,7 +53,6 @@ memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcache_secret_key }} memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %} memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
[glance_client] [glance_client]
auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }} auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}
auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }} auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
@ -66,3 +65,13 @@ password = {{ zun_keystone_password }}
region_name = {{ openstack_region_name }} region_name = {{ openstack_region_name }}
endpoint_type = internalURL endpoint_type = internalURL
api_version = 2 api_version = 2
{% if enable_osprofiler | bool %}
[profiler]
enabled = true
trace_sqlalchemy = true
hmac_keys = {{ osprofiler_secret }}
{% if enable_elasticsearch | bool %}
connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
{% endif %}
{% endif %}

View File

@ -71,6 +71,7 @@ Services
networking-guide networking-guide
kuryr-guide kuryr-guide
zun-guide zun-guide
osprofiler-guide
Developer Docs Developer Docs
============== ==============

55
doc/osprofiler-guide.rst Normal file
View File

@ -0,0 +1,55 @@
.. _osprofiler-guide:
===================
OSprofiler in Kolla
===================
Overview
========
OSProfiler provides a tiny but powerful library that is used by most
(soon to be all) OpenStack projects and their corresponding python clients
as well as the Openstack client.
It provides functionality to generate 1 trace per request, that goes
through all involved services. This trace can then be extracted and used
to build a tree of calls which can be quite handy for a variety of reasons
(for example in isolating cross-project performance issues).
Configuration on Kolla deployment
---------------------------------
Enable OSprofiler in ``/etc/kolla/globals.yml``
.. code-block:: console
enable_osprofiler: "yes"
enable_elasticsearch: "yes"
Verify operation
----------------
Retrieve ``osprofiler_secret`` key present at ``/etc/kolla/passwords.yml``.
Profiler UUIDs can be created executing OpenStack clients (Nova, Glance, Cinder, Heat, Keystone)
with ``--profile`` option or using the official Openstack client with ``--os-profile``.
In example to get the OSprofiler trace UUID for ``openstack server create``.
.. code-block:: console
$ openstack --os-profile <OSPROFILER_SECRET> \
server create \
--image cirros \
--flavor m1.tiny \
--key-name mykey \
--nic net-id=${NETWORK_ID} \
demo
The previous command will output the command to retrieve OSprofiler trace.
.. code-block:: console
$ osprofiler trace show --html <TRACE_ID> --connection-string elasticsearch://<api_interface_address>:9200
For more information about how OSprofiler works, see
`OSProfiler Cross-project profiling library
<https://docs.openstack.org/developer/osprofiler/>`__.

View File

@ -180,6 +180,7 @@ kolla_internal_vip_address: "10.10.10.254"
#enable_nova_serialconsole_proxy: "no" #enable_nova_serialconsole_proxy: "no"
#enable_octavia: "no" #enable_octavia: "no"
#enable_openvswitch: "{{ neutron_plugin_agent != 'linuxbridge' | bool }}" #enable_openvswitch: "{{ neutron_plugin_agent != 'linuxbridge' | bool }}"
#enable_osprofiler: "no"
#enable_panko: "no" #enable_panko: "no"
#enable_rally: "no" #enable_rally: "no"
#enable_sahara: "no" #enable_sahara: "no"

View File

@ -149,6 +149,9 @@ zun_keystone_password:
memcache_secret_key: memcache_secret_key:
#HMAC secret key
osprofiler_secret:
nova_ssh_key: nova_ssh_key:
private_key: private_key:
public_key: public_key:

View File

@ -69,7 +69,8 @@ def main():
blank_keys = ['docker_registry_password'] blank_keys = ['docker_registry_password']
# HMAC-MD5 keys # HMAC-MD5 keys
hmac_md5_keys = ['designate_rndc_key'] hmac_md5_keys = ['designate_rndc_key',
'osprofiler_secret']
# HMAC-SHA256 keys # HMAC-SHA256 keys
hmac_sha256_keys = ['barbican_crypto_key'] hmac_sha256_keys = ['barbican_crypto_key']

View File

@ -0,0 +1,4 @@
---
features:
- |
Osprofiler support has been implemented in OpenStack services