commit python-osprofiler for openSUSE:Factory
Hello community, here is the log from the commit of package python-osprofiler for openSUSE:Factory checked in at 2019-05-03 22:43:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-osprofiler (Old) and /work/SRC/openSUSE:Factory/.python-osprofiler.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-osprofiler" Fri May 3 22:43:02 2019 rev:9 rq:692872 version:2.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-osprofiler/python-osprofiler.changes 2019-03-13 09:13:08.675399651 +0100 +++ /work/SRC/openSUSE:Factory/.python-osprofiler.new.5148/python-osprofiler.changes 2019-05-03 22:43:04.079322490 +0200 @@ -1,0 +2,31 @@ +Mon Apr 8 14:04:49 UTC 2019 - cloud-devel@suse.de + +- update to version 2.6.0 + - Switch to stestr + - When shortening span-ids, check if they're already short + - Do not insert osprofiler filter into Neutron api-paste pipeline + - Change python3.5 job to python3.7 job on Stein+ + - import zuul job settings from project-config + - [devstack] Add support for elasticsearch backend + - Change openstack-dev to openstack-discuss + - Update reno for stable/rocky + - Update min tox version to 2.0 + - Don't quote {posargs} in tox.ini + - add python 3.6 unit test job + - Make tracing of SQL statements configurable in DevStack plugin + - add lib-forward-testing-python3 test job + - build universal wheels + - Reload keystone to apply osprofiler config + - Allow test path to be overridden + - Add sqlalchemy collector + - Configure Jaeger collector in DevStack + - add password for connecting redis-sentinel + - Add support for mongodb backend in devstack plugin + - In DevStack install Redis client library via pip, not as system package + - Use $STACK_USER variable in install_jaeger function + - Change http to https in reference link + - In case of an error, always add message + - Use templates for cover and lower-constraints +- remove 0001-Add-sqlalchemy-collector.patch and 0001-Don-t-fail-if-sqlalchemy-driver-fails-to-initialize.patch + +------------------------------------------------------------------- Old: ---- 0001-Add-sqlalchemy-collector.patch 0001-Don-t-fail-if-sqlalchemy-driver-fails-to-initialize.patch osprofiler-2.3.0.tar.gz New: ---- osprofiler-2.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-osprofiler.spec ++++++ --- /var/tmp/diff_new_pack.FTmZVM/_old 2019-05-03 22:43:04.651323694 +0200 +++ /var/tmp/diff_new_pack.FTmZVM/_new 2019-05-03 22:43:04.655323703 +0200 @@ -17,22 +17,19 @@ Name: python-osprofiler -Version: 2.3.0 +Version: 2.6.0 Release: 0 Summary: OpenStack Profiler Library License: Apache-2.0 Group: Development/Languages/Python URL: https://launchpad.net/osprofiler -Source0: https://files.pythonhosted.org/packages/source/o/osprofiler/osprofiler-2.3.0... -# backport sql collector -- https://github.com/openstack/osprofiler/commit/032a21861854c5f63a039c997a58b... -Patch0: 0001-Add-sqlalchemy-collector.patch -# https://review.openstack.org/#/c/642407/ -Patch1: 0001-Don-t-fail-if-sqlalchemy-driver-fails-to-initialize.patch +Source0: https://files.pythonhosted.org/packages/source/o/osprofiler/osprofiler-2.6.0... BuildRequires: openstack-macros BuildRequires: python-devel BuildRequires: python2-PrettyTable >= 0.7.2 BuildRequires: python2-WebOb >= 1.7.1 BuildRequires: python2-ddt +BuildRequires: python2-docutils BuildRequires: python2-elasticsearch BuildRequires: python2-mock BuildRequires: python2-oslo.concurrency >= 3.26.0 @@ -43,12 +40,13 @@ BuildRequires: python2-python-subunit BuildRequires: python2-redis BuildRequires: python2-six >= 1.10.0 -BuildRequires: python2-testrepository +BuildRequires: python2-stestr BuildRequires: python2-testtools BuildRequires: python3-PrettyTable >= 0.7.2 BuildRequires: python3-WebOb >= 1.7.1 BuildRequires: python3-ddt BuildRequires: python3-devel +BuildRequires: python3-docutils BuildRequires: python3-elasticsearch BuildRequires: python3-mock BuildRequires: python3-oslo.concurrency >= 3.26.0 @@ -59,7 +57,7 @@ BuildRequires: python3-python-subunit BuildRequires: python3-redis BuildRequires: python3-six >= 1.10.0 -BuildRequires: python3-testrepository +BuildRequires: python3-stestr BuildRequires: python3-testtools Requires: python-PrettyTable >= 0.7.2 Requires: python-WebOb >= 1.7.1 @@ -97,9 +95,8 @@ Documentation for OSProfiler. %prep -%autosetup -p1 -n osprofiler-2.3.0 +%autosetup -p1 -n osprofiler-2.6.0 %py_req_cleanup -sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg %build %{python_build} @@ -120,9 +117,7 @@ %python_uninstall_alternative osprofiler %check -%{python_expand rm -rf .testrepository -$python setup.py testr --testr-args '(?!^osprofiler.tests.unit.drivers.test_jaeger.JaegerTestCase.*$)(^.*$)' -} +%python_exec -m stestr.cli run --black-regex '(^osprofiler.tests.unit.drivers.test_jaeger.JaegerTestCase.*$)' %files %{python_files} %license LICENSE ++++++ _service ++++++ --- /var/tmp/diff_new_pack.FTmZVM/_old 2019-05-03 22:43:04.671323737 +0200 +++ /var/tmp/diff_new_pack.FTmZVM/_new 2019-05-03 22:43:04.675323745 +0200 @@ -1,8 +1,8 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/rocky/openstack/osprofiler/osprofiler.spec.j2</param> + <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/stein/openstack/osprofiler/osprofiler.spec.j2</param> <param name="output-name">python-osprofiler.spec</param> - <param name="requirements">https://raw.githubusercontent.com/openstack/osprofiler/stable/rocky/requirements.txt</param> + <param name="requirements">https://raw.githubusercontent.com/openstack/osprofiler/stable/stein/requirements.txt</param> <param name="changelog-email">cloud-devel@suse.de</param> <param name="changelog-provider">gh,openstack,osprofiler</param> </service> ++++++ osprofiler-2.3.0.tar.gz -> osprofiler-2.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/.stestr.conf new/osprofiler-2.6.0/.stestr.conf --- old/osprofiler-2.3.0/.stestr.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/osprofiler-2.6.0/.stestr.conf 2019-02-18 22:52:33.000000000 +0100 @@ -0,0 +1,4 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./osprofiler/tests/unit} +top_dir=./ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/.testr.conf new/osprofiler-2.6.0/.testr.conf --- old/osprofiler-2.3.0/.testr.conf 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/.testr.conf 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./osprofiler/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/.zuul.yaml new/osprofiler-2.6.0/.zuul.yaml --- old/osprofiler-2.3.0/.zuul.yaml 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/.zuul.yaml 2019-02-18 22:52:33.000000000 +0100 @@ -1,11 +1,21 @@ - project: + templates: + - check-requirements + - lib-forward-testing + - lib-forward-testing-python3 + - openstack-cover-jobs + - openstack-lower-constraints-jobs + - openstack-python-jobs + - openstack-python36-jobs + - openstack-python37-jobs + - periodic-stable-jobs + - publish-openstack-docs-pti + - release-notes-jobs-python3 check: jobs: - openstack-tox-functional - openstack-tox-functional-py35 - - openstack-tox-lower-constraints gate: jobs: - openstack-tox-functional - openstack-tox-functional-py35 - - openstack-tox-lower-constraints diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/AUTHORS new/osprofiler-2.6.0/AUTHORS --- old/osprofiler-2.3.0/AUTHORS 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/AUTHORS 2019-02-18 22:53:41.000000000 +0100 @@ -5,11 +5,13 @@ Andreas Jaeger <aj@suse.com> Andreas Jaeger <aj@suse.de> Andrey Kurilin <akurilin@mirantis.com> +Andrey Kurilin <andr.kurilin@gmail.com> Atsushi SAKAI <sakaia@jp.fujitsu.com> BENJAMIN VANHAVERMAET <bvanhav@us.ibm.com> Boris Pavlovic <boris@pavlovic.me> Carlos Goncalves <carlos.goncalves@neclab.eu> ChangBo Guo(gcb) <eric.guo@easystack.cn> +Corey Bryant <corey.bryant@canonical.com> Davanum Srinivas <davanum@gmail.com> Dina Belova <dbelova@mirantis.com> Doug Hellmann <doug@doughellmann.com> @@ -29,12 +31,15 @@ Moshe Levi <moshele@mellanox.com> Munoz, Obed N <obed.n.munoz@intel.com> Nguyen Van Duc <ducnv@vn.fujitsu.com> +Nguyen Van Trung <trungnv@vn.fujitsu.com> Oleksii Chuprykov <ochuprykov@mirantis.com> Omer Anson <omer.anson@toganetworks.com> Ondřej Nový <ondrej.novy@firma.seznam.cz> OpenStack Release Bot <infra-root@openstack.org> Roman Podoliaka <rpodolyaka@mirantis.com> +Shoham Peller <shohamp@gmail.com> Simon Pasquier <spasquier@mirantis.com> +Slawek Kaplonski <skaplons@redhat.com> Stephen Finucane <stephenfin@redhat.com> Stuart Grace <stuart.grace@bbc.co.uk> Thomas Bechtold <tbechtold@suse.com> @@ -42,14 +47,15 @@ Tony Xu <hhktony@gmail.com> Tovin Seven <vinhnt@vn.fujitsu.com> Victor Morales <victor.morales@intel.com> +Vieri <15050873171@163.com> Vipin Balachandran <vbala@vmware.com> Vu Cong Tuan <tuanvc@vn.fujitsu.com> Zhi Yan Liu <zhiyanl@cn.ibm.com> -Zuul <zuul@review.openstack.org> chenxu <424024687@qq.com> gecong1973 <ge.cong@zte.com.cn> howardlee <lihongweibj@inspur.com> kavithahr <kavitha.r@nectechnologies.in> +lipan <lipan7195@fiberhome.com> lvdongbing <dongbing.lv@kylin-cloud.com> melissaml <ma.lei@99cloud.net> qingszhao <zhao.daqing@99cloud.net> @@ -60,3 +66,4 @@ sunyandi <sunyd@inspur.com> uppi <helendile@gmail.com> wangxiyuan <wangxiyuan@huawei.com> +zhouxinyong <zhouxinyong@inspur.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/ChangeLog new/osprofiler-2.6.0/ChangeLog --- old/osprofiler-2.3.0/ChangeLog 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/ChangeLog 2019-02-18 22:53:41.000000000 +0100 @@ -1,6 +1,51 @@ CHANGES ======= +2.6.0 +----- + +* Add sqlalchemy collector +* Change python3.5 job to python3.7 job on Stein+ +* Use $STACK\_USER variable in install\_jaeger function +* Add support for mongodb backend in devstack plugin +* Reload keystone to apply osprofiler config +* Do not insert osprofiler filter into Neutron api-paste pipeline +* Allow test path to be overridden + +2.5.2 +----- + +* In case of an error, always add message +* Change http to https in reference link +* [devstack] Add support for elasticsearch backend +* Change openstack-dev to openstack-discuss +* Configure Jaeger collector in DevStack + +2.5.1 +----- + +* Update min tox version to 2.0 +* In DevStack install Redis client library via pip, not as system package +* When shortening span-ids, check if they're already short +* Don't quote {posargs} in tox.ini + +2.5.0 +----- + +* build universal wheels +* Make tracing of SQL statements configurable in DevStack plugin + +2.4.1 +----- + +* Use templates for cover and lower-constraints +* add password for connecting redis-sentinel +* add lib-forward-testing-python3 test job +* add python 3.6 unit test job +* import zuul job settings from project-config +* Update reno for stable/rocky +* Switch to stestr + 2.3.0 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/PKG-INFO new/osprofiler-2.6.0/PKG-INFO --- old/osprofiler-2.3.0/PKG-INFO 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/PKG-INFO 2019-02-18 22:53:41.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 2.1 Name: osprofiler -Version: 2.3.0 +Version: 2.6.0 Summary: OpenStack Profiler Library Home-page: https://docs.openstack.org/osprofiler/latest/ Author: OpenStack -Author-email: openstack-dev@lists.openstack.org +Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== Team and repository tags @@ -51,5 +51,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.5 -Provides-Extra: test Provides-Extra: oslo_config +Provides-Extra: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/RELEASENOTES.rst new/osprofiler-2.6.0/RELEASENOTES.rst --- old/osprofiler-2.3.0/RELEASENOTES.rst 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/RELEASENOTES.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -========== -osprofiler -========== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/devstack/README.rst new/osprofiler-2.6.0/devstack/README.rst --- old/osprofiler-2.3.0/devstack/README.rst 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/devstack/README.rst 2019-02-18 22:52:33.000000000 +0100 @@ -16,6 +16,7 @@ * ``<empty>`` - default messaging driver is used * ``redis`` - Redis is installed + * ``jaeger`` - Jaeger is installed The default value of ``OSPROFILER_CONNECTION_STRING`` is set automatically depending on ``OSPROFILER_COLLECTOR`` value. @@ -29,6 +30,7 @@ * ``elasticsearch://host:port`` - use Elasticsearch as trace storage * ``mongodb://host:port`` - use MongoDB as trace storage * ``loginsight://username:password@host`` - use LogInsight as trace collector/storage + * ``jaeger://host:port`` - use Jaeger as trace collector To configure DevStack and enable OSProfiler edit ``${DEVSTACK_DIR}/local.conf`` @@ -69,7 +71,7 @@ **OSPROFILER_CONNECTION_STRING** - connection string to identify the driver. Default value is ``messaging://`` refers to messaging driver. For a full list of drivers please refer to -``http://git.openstack.org/cgit/openstack/osprofiler/tree/osprofiler/drivers``. +``https://git.openstack.org/cgit/openstack/osprofiler/tree/osprofiler/drivers``. Example: enable ElasticSearch driver with the server running on localhost:: OSPROFILER_CONNECTION_STRING=elasticsearch://127.0.0.1:9200 @@ -80,3 +82,9 @@ Example: enable Redis collector:: OSPROFILER_COLLECTOR=redis + +**OSPROFILER_TRACE_SQLALCHEMY** - controls tracing of SQL statements. If enabled, +all SQL statements processed by SQL Alchemy are added into traces. By default enabled. +Example: disable SQL statements tracing:: + + OSPROFILER_TRACE_SQLALCHEMY=False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/devstack/lib/osprofiler new/osprofiler-2.6.0/devstack/lib/osprofiler --- old/osprofiler-2.3.0/devstack/lib/osprofiler 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/devstack/lib/osprofiler 2019-02-18 22:52:33.000000000 +0100 @@ -42,16 +42,59 @@ function install_redis() { if is_fedora; then - install_package redis python-redis + install_package redis elif is_ubuntu; then - install_package redis-server python-redis + install_package redis-server elif is_suse; then - install_package redis python-redis + install_package redis else exit_distro_not_supported "redis installation" fi start_service redis + + pip_install_gr redis +} + +function install_jaeger() { + if is_ubuntu; then + install_package docker.io + start_service docker + add_user_to_group $STACK_USER docker + sg docker -c "docker run -d --name jaeger -p 6831:6831/udp -p 16686:16686 jaegertracing/all-in-one:1.7" + else + exit_distro_not_supported "docker.io installation" + fi + + pip_install jaeger-client +} + +function install_elasticsearch() { + if is_ubuntu; then + install_package docker.io + start_service docker + add_user_to_group $STACK_USER docker + # https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html#dock... + sg docker -c 'docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.6.14' + else + exit_distro_not_supported "docker.io installation" + fi + + pip_install elasticsearch +} + +function install_mongodb { + pip_install pymongo + if is_ubuntu; then + install_package mongodb-server + start_service mongodb + elif is_fedora; then + install_package mongodb + install_package mongodb-server + start_service mongod + else + exit_distro_not_supported "mongodb installation" + fi } function install_osprofiler_collector() { @@ -60,6 +103,15 @@ elif [ "$OSPROFILER_COLLECTOR" == "redis" ]; then install_redis OSPROFILER_CONNECTION_STRING=${OSPROFILER_CONNECTION_STRING:-"redis://localhost:6379"} + elif [ "$OSPROFILER_COLLECTOR" == "jaeger" ]; then + install_jaeger + OSPROFILER_CONNECTION_STRING=${OSPROFILER_CONNECTION_STRING:-"jaeger://localhost:6831"} + elif [ "$OSPROFILER_COLLECTOR" == "elasticsearch" ]; then + install_elasticsearch + OSPROFILER_CONNECTION_STRING=${OSPROFILER_CONNECTION_STRING:-"elasticsearch://elastic:changeme@localhost:9200"} + elif [ "$OSPROFILER_COLLECTOR" == "mongodb" ]; then + install_mongodb + OSPROFILER_CONNECTION_STRING=${OSPROFILER_CONNECTION_STRING:-"mongodb://localhost:27017"} else die $LINENO "OSProfiler collector $OSPROFILER_COLLECTOR is not supported" fi @@ -71,18 +123,14 @@ if [ -f $conf ] then iniset $conf profiler enabled True - iniset $conf profiler trace_sqlalchemy True + iniset $conf profiler trace_sqlalchemy $OSPROFILER_TRACE_SQLALCHEMY iniset $conf profiler hmac_keys $OSPROFILER_HMAC_KEYS iniset $conf profiler connection_string $OSPROFILER_CONNECTION_STRING fi done - # Insert osprofiler filter into Neutron paste configuration - if [ -f $Q_API_PASTE_FILE ]; then - VAL=$(iniget $Q_API_PASTE_FILE composite:neutronapi_v2_0 keystone) - VAL=${VAL/catch_errors/catch_errors osprofiler} - iniset $Q_API_PASTE_FILE composite:neutronapi_v2_0 keystone "$VAL" - fi + # Keystone is already running, should be reloaded to apply osprofiler config + reload_service devstack@keystone } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/devstack/plugin.sh new/osprofiler-2.6.0/devstack/plugin.sh --- old/osprofiler-2.3.0/devstack/plugin.sh 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/devstack/plugin.sh 2019-02-18 22:52:33.000000000 +0100 @@ -7,7 +7,7 @@ source $DEST/osprofiler/devstack/lib/osprofiler -if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then +if [[ "$1" == "stack" && "$2" == "install" ]]; then echo_summary "Configuring system services for OSProfiler" install_osprofiler_collector diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/devstack/settings new/osprofiler-2.6.0/devstack/settings --- old/osprofiler-2.3.0/devstack/settings 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/devstack/settings 2019-02-18 22:52:33.000000000 +0100 @@ -5,4 +5,7 @@ # requests that specify one of these keys in HTTP headers. OSPROFILER_HMAC_KEYS=${OSPROFILER_HMAC_KEYS:-"SECRET_KEY"} +# Set whether tracing of SQL requests is enabled or not +OSPROFILER_TRACE_SQLALCHEMY="True" + enable_service osprofiler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/doc/source/user/collectors.rst new/osprofiler-2.6.0/doc/source/user/collectors.rst --- old/osprofiler-2.3.0/doc/source/user/collectors.rst 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/doc/source/user/collectors.rst 2019-02-18 22:52:33.000000000 +0100 @@ -39,3 +39,28 @@ value. Defaults to: 0.1 seconds * sentinel_service_name: The name of the Sentinel service to use. Defaults to: "mymaster" + +SQLAlchemy +---------- + +The SQLAlchemy collector allows you to store profiling data into a database +supported by SQLAlchemy. + +Usage +===== +To use the driver, the `connection_string` in the `[osprofiler]` config section +needs to be set to a connection string that `SQLAlchemy understands`_ +For example:: + + [osprofiler] + connection_string = mysql+pymysql://username:password@192.168.192.81/profiler?charset=utf8 + +where `username` is the database username, `password` is the database password, +`192.168.192.81` is the database IP address and `profiler` is the database name. + +The database (in this example called `profiler`) needs to be created manually and +the database user (in this example called `username`) needs to have priviliges +to create tables and select and insert rows. + + +.. _SQLAlchemy understands: https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/lower-constraints.txt new/osprofiler-2.6.0/lower-constraints.txt --- old/osprofiler-2.3.0/lower-constraints.txt 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/lower-constraints.txt 2019-02-18 22:52:33.000000000 +0100 @@ -18,6 +18,6 @@ requests===2.14.2 six===1.10.0 sphinx===1.6.2 -testrepository===0.0.18 +stestr==2.0.0 testtools===2.2.0 WebOb===1.7.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/_utils.py new/osprofiler-2.6.0/osprofiler/_utils.py --- old/osprofiler-2.3.0/osprofiler/_utils.py 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/_utils.py 2019-02-18 22:52:33.000000000 +0100 @@ -153,8 +153,11 @@ def shorten_id(span_id): """Convert from uuid4 to 64 bit id for OpenTracing""" + int64_max = (1 << 64) - 1 + if isinstance(span_id, six.integer_types): + return span_id & int64_max try: - short_id = uuid.UUID(span_id).int & (1 << 64) - 1 + short_id = uuid.UUID(span_id).int & int64_max except ValueError: # Return a new short id for this short_id = shorten_id(uuidutils.generate_uuid()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/drivers/__init__.py new/osprofiler-2.6.0/osprofiler/drivers/__init__.py --- old/osprofiler-2.3.0/osprofiler/drivers/__init__.py 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/drivers/__init__.py 2019-02-18 22:52:33.000000000 +0100 @@ -5,3 +5,4 @@ from osprofiler.drivers import messaging # noqa from osprofiler.drivers import mongodb # noqa from osprofiler.drivers import redis_driver # noqa +from osprofiler.drivers import sqlalchemy_driver # noqa diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/drivers/base.py new/osprofiler-2.6.0/osprofiler/drivers/base.py --- old/osprofiler-2.3.0/osprofiler/drivers/base.py 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/drivers/base.py 2019-02-18 22:52:33.000000000 +0100 @@ -36,6 +36,12 @@ connection_string) backend = parsed_connection.scheme + # NOTE(toabctl): To be able to use the connection_string for as sqlalchemy + # connection string, transform the backend to the correct driver + # See https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls + if backend in ["mysql", "mysql+pymysql", "mysql+mysqldb", + "postgresql", "postgresql+psycopg2"]: + backend = "sqlalchemy" for driver in _utils.itersubclasses(Driver): if backend == driver.get_name(): return driver(connection_string, *args, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/drivers/redis_driver.py new/osprofiler-2.6.0/osprofiler/drivers/redis_driver.py --- old/osprofiler-2.3.0/osprofiler/drivers/redis_driver.py 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/drivers/redis_driver.py 2019-02-18 22:52:33.000000000 +0100 @@ -175,6 +175,7 @@ socket_timeout = self.conf.profiler.socket_timeout parsed_url = parser.urlparse(self.connection_str) sentinel = Sentinel([(parsed_url.hostname, int(parsed_url.port))], + password=parsed_url.password, socket_timeout=socket_timeout) self.db = sentinel.master_for(self.conf.profiler.sentinel_service_name, socket_timeout=socket_timeout) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/drivers/sqlalchemy_driver.py new/osprofiler-2.6.0/osprofiler/drivers/sqlalchemy_driver.py --- old/osprofiler-2.3.0/osprofiler/drivers/sqlalchemy_driver.py 1970-01-01 01:00:00.000000000 +0100 +++ new/osprofiler-2.6.0/osprofiler/drivers/sqlalchemy_driver.py 2019-02-18 22:52:33.000000000 +0100 @@ -0,0 +1,119 @@ +# Copyright 2019 SUSE Linux GmbH +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import logging + +from oslo_serialization import jsonutils + +from osprofiler.drivers import base +from osprofiler import exc + +LOG = logging.getLogger(__name__) + + +class SQLAlchemyDriver(base.Driver): + def __init__(self, connection_str, project=None, service=None, host=None, + **kwargs): + super(SQLAlchemyDriver, self).__init__(connection_str, project=project, + service=service, host=host) + + try: + from sqlalchemy import create_engine + from sqlalchemy import Table, MetaData, Column + from sqlalchemy import String, JSON, Integer + except ImportError: + raise exc.CommandError( + "To use this command, you should install 'SQLAlchemy'") + + self._engine = create_engine(connection_str) + self._conn = self._engine.connect() + self._metadata = MetaData() + self._data_table = Table( + "data", self._metadata, + Column("id", Integer, primary_key=True), + # timestamp - date/time of the trace point + Column("timestamp", String(26), index=True), + # base_id - uuid common for all notifications related to one trace + Column("base_id", String(255), index=True), + # parent_id - uuid of parent element in trace + Column("parent_id", String(255), index=True), + # trace_id - uuid of current element in trace + Column("trace_id", String(255), index=True), + Column("project", String(255), index=True), + Column("host", String(255), index=True), + Column("service", String(255), index=True), + # name - trace point name + Column("name", String(255), index=True), + Column("data", JSON) + ) + + # FIXME(toabctl): Not the best idea to create the table on every + # startup when using the sqlalchemy driver... + self._metadata.create_all(self._engine, checkfirst=True) + + @classmethod + def get_name(cls): + return "sqlalchemy" + + def notify(self, info, context=None): + """Write a notification the the database""" + data = info.copy() + base_id = data.pop("base_id", None) + timestamp = data.pop("timestamp", None) + parent_id = data.pop("parent_id", None) + trace_id = data.pop("trace_id", None) + project = data.pop("project", self.project) + host = data.pop("host", self.host) + service = data.pop("service", self.service) + name = data.pop("name", None) + + ins = self._data_table.insert().values( + timestamp=timestamp, + base_id=base_id, + parent_id=parent_id, + trace_id=trace_id, + project=project, + service=service, + host=host, + name=name, + data=jsonutils.dumps(data) + ) + try: + self._conn.execute(ins) + except Exception: + LOG.exception("Can not store osprofiler tracepoint {} " + "(base_id {})".format(trace_id, base_id)) + + def get_report(self, base_id): + try: + from sqlalchemy.sql import select + except ImportError: + raise exc.CommandError( + "To use this command, you should install 'SQLAlchemy'") + stmt = select([self._data_table]).where( + self._data_table.c.base_id == base_id) + results = self._conn.execute(stmt).fetchall() + for n in results: + timestamp = n["timestamp"] + trace_id = n["trace_id"] + parent_id = n["parent_id"] + name = n["name"] + project = n["project"] + service = n["service"] + host = n["host"] + data = jsonutils.loads(n["data"]) + self._append_results(trace_id, parent_id, name, project, service, + host, timestamp, data) + return self._parse_results() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/profiler.py new/osprofiler-2.6.0/osprofiler/profiler.py --- old/osprofiler-2.3.0/osprofiler/profiler.py 2018-07-10 00:57:27.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/profiler.py 2019-02-18 22:52:33.000000000 +0100 @@ -17,6 +17,7 @@ import datetime import functools import inspect +import six import socket import threading @@ -158,7 +159,10 @@ start(name, info=info_) result = f(*args, **kwargs) except Exception as ex: - stop_info = {"etype": reflection.get_class_name(ex)} + stop_info = { + "etype": reflection.get_class_name(ex), + "message": six.text_type(ex) + } raise else: if not hide_result: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/sqlalchemy.py new/osprofiler-2.6.0/osprofiler/sqlalchemy.py --- old/osprofiler-2.3.0/osprofiler/sqlalchemy.py 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/sqlalchemy.py 2019-02-18 22:52:33.000000000 +0100 @@ -105,6 +105,7 @@ info = { "etype": exception_class_name, + "message": original_exception, "db": { "original_exception": original_exception, "chained_exception": chained_exception diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/tests/unit/test_profiler.py new/osprofiler-2.6.0/osprofiler/tests/unit/test_profiler.py --- old/osprofiler-2.3.0/osprofiler/tests/unit/test_profiler.py 2018-07-10 00:57:27.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/tests/unit/test_profiler.py 2019-02-18 22:52:33.000000000 +0100 @@ -69,6 +69,13 @@ expected = "850409eb1d4b0dee" self.assertEqual(expected, result) + def test_profiler_get_shorten_id_int(self): + short_id_int = 42 + prof = profiler._Profiler("secret", base_id="1", parent_id="2") + result = prof.get_shorten_id(short_id_int) + expected = "2a" + self.assertEqual(expected, result) + def test_profiler_get_base_id(self): prof = profiler._Profiler("secret", base_id="1", parent_id="2") self.assertEqual(prof.get_base_id(), "1") @@ -253,7 +260,7 @@ "name": "osprofiler.tests.unit.test_profiler.test_fn_exc" } } - expected_stop_info = {"etype": "ValueError"} + expected_stop_info = {"etype": "ValueError", "message": ""} mock_start.assert_called_once_with("foo", info=expected_info) mock_stop.assert_called_once_with(info=expected_stop_info) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler/tests/unit/test_sqlalchemy.py new/osprofiler-2.6.0/osprofiler/tests/unit/test_sqlalchemy.py --- old/osprofiler-2.3.0/osprofiler/tests/unit/test_sqlalchemy.py 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler/tests/unit/test_sqlalchemy.py 2019-02-18 22:52:33.000000000 +0100 @@ -62,6 +62,7 @@ sqlalchemy.handle_error(sqlalchemy_exception_ctx) expected_info = { "etype": "Exception", + "message": "error", "db": { "original_exception": str(original_exception), "chained_exception": str(chained_exception), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler.egg-info/PKG-INFO new/osprofiler-2.6.0/osprofiler.egg-info/PKG-INFO --- old/osprofiler-2.3.0/osprofiler.egg-info/PKG-INFO 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler.egg-info/PKG-INFO 2019-02-18 22:53:41.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 2.1 Name: osprofiler -Version: 2.3.0 +Version: 2.6.0 Summary: OpenStack Profiler Library Home-page: https://docs.openstack.org/osprofiler/latest/ Author: OpenStack -Author-email: openstack-dev@lists.openstack.org +Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== Team and repository tags @@ -51,5 +51,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.5 -Provides-Extra: test Provides-Extra: oslo_config +Provides-Extra: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler.egg-info/SOURCES.txt new/osprofiler-2.6.0/osprofiler.egg-info/SOURCES.txt --- old/osprofiler-2.3.0/osprofiler.egg-info/SOURCES.txt 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler.egg-info/SOURCES.txt 2019-02-18 22:53:41.000000000 +0100 @@ -1,4 +1,4 @@ -.testr.conf +.stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst @@ -64,6 +64,7 @@ osprofiler/drivers/messaging.py osprofiler/drivers/mongodb.py osprofiler/drivers/redis_driver.py +osprofiler/drivers/sqlalchemy_driver.py osprofiler/hacking/__init__.py osprofiler/hacking/checks.py osprofiler/tests/__init__.py @@ -97,6 +98,7 @@ releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/queens.rst +releasenotes/source/rocky.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler.egg-info/pbr.json new/osprofiler-2.6.0/osprofiler.egg-info/pbr.json --- old/osprofiler-2.3.0/osprofiler.egg-info/pbr.json 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler.egg-info/pbr.json 2019-02-18 22:53:41.000000000 +0100 @@ -1 +1 @@ -{"git_version": "6d68170", "is_release": true} \ No newline at end of file +{"git_version": "da7a859", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/osprofiler.egg-info/requires.txt new/osprofiler-2.6.0/osprofiler.egg-info/requires.txt --- old/osprofiler-2.3.0/osprofiler.egg-info/requires.txt 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/osprofiler.egg-info/requires.txt 2019-02-18 22:53:41.000000000 +0100 @@ -15,7 +15,7 @@ coverage>=4.0 ddt>=1.0.1 mock>=2.0.0 -testrepository>=0.0.18 +stestr>=2.0.0 testtools>=2.2.0 openstackdocstheme>=1.18.1 sphinx>=1.6.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/releasenotes/notes/reno.cache new/osprofiler-2.6.0/releasenotes/notes/reno.cache --- old/osprofiler-2.3.0/releasenotes/notes/reno.cache 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/releasenotes/notes/reno.cache 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ ---- -file-contents: {} -notes: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/releasenotes/source/index.rst new/osprofiler-2.6.0/releasenotes/source/index.rst --- old/osprofiler-2.3.0/releasenotes/source/index.rst 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/releasenotes/source/index.rst 2019-02-18 22:52:33.000000000 +0100 @@ -6,6 +6,7 @@ :maxdepth: 1 unreleased + rocky queens pike ocata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/releasenotes/source/rocky.rst new/osprofiler-2.6.0/releasenotes/source/rocky.rst --- old/osprofiler-2.3.0/releasenotes/source/rocky.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/osprofiler-2.6.0/releasenotes/source/rocky.rst 2019-02-18 22:52:33.000000000 +0100 @@ -0,0 +1,6 @@ +=================================== + Rocky Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/rocky diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/setup.cfg new/osprofiler-2.6.0/setup.cfg --- old/osprofiler-2.3.0/setup.cfg 2018-07-10 00:59:13.000000000 +0200 +++ new/osprofiler-2.6.0/setup.cfg 2019-02-18 22:53:41.000000000 +0100 @@ -4,7 +4,7 @@ description-file = README.rst author = OpenStack -author-email = openstack-dev@lists.openstack.org +author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/osprofiler/latest/ classifier = Environment :: OpenStack @@ -43,6 +43,9 @@ paste.filter_factory = osprofiler = osprofiler.web:WsgiMiddleware.factory +[wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/test-requirements.txt new/osprofiler-2.6.0/test-requirements.txt --- old/osprofiler-2.3.0/test-requirements.txt 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/test-requirements.txt 2019-02-18 22:52:33.000000000 +0100 @@ -3,7 +3,7 @@ coverage>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT mock>=2.0.0 # BSD -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT openstackdocstheme>=1.18.1 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osprofiler-2.3.0/tox.ini new/osprofiler-2.6.0/tox.ini --- old/osprofiler-2.3.0/tox.ini 2018-07-10 00:57:10.000000000 +0200 +++ new/osprofiler-2.6.0/tox.ini 2019-02-18 22:52:33.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -minversion = 1.6 +minversion = 2.0 skipsdist = True envlist = py35,py27,pep8 @@ -14,12 +14,9 @@ -r{toxinidir}/test-requirements.txt install_command = pip install -U {opts} {packages} usedevelop = True -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = stestr run --slowest {posargs} distribute = false -[testenv:py27] -basepython = python2.7 - [testenv:functional] basepython = python2.7 setenv = {[testenv]setenv} @@ -47,7 +44,13 @@ [testenv:cover] basepython = python3 -commands = python setup.py testr --coverage --testr-args='{posargs}' +setenv = + PYTHON=coverage run --source osprofiler --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:docs] basepython = python3
participants (1)
-
root