Added python clients patches
Moved nova patches to corresponding folder Change-Id: I97ea96b720460d3c28875bc0637aa5dfd00bcac6
This commit is contained in:
parent
bb31491be5
commit
6d44c4930d
@ -0,0 +1,44 @@
|
||||
From b446eb5b463f944ae7af900fc818b28d0779feb1 Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Fri, 11 Oct 2013 12:28:28 +0300
|
||||
Subject: [PATCH 1/3] Added tomograph middleware
|
||||
|
||||
---
|
||||
etc/keystone-paste.ini | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/etc/keystone-paste.ini b/etc/keystone-paste.ini
|
||||
index 6b709ba..a5c1e1a 100644
|
||||
--- a/etc/keystone-paste.ini
|
||||
+++ b/etc/keystone-paste.ini
|
||||
@@ -48,6 +48,10 @@ paste.filter_factory = keystone.contrib.stats:StatsExtension.factory
|
||||
[filter:access_log]
|
||||
paste.filter_factory = keystone.contrib.access:AccessLogMiddleware.factory
|
||||
|
||||
+[filter:tomograph]
|
||||
+paste.filter_factory = tomograph:Middleware.factory
|
||||
+service_name = keystone
|
||||
+
|
||||
[app:public_service]
|
||||
paste.app_factory = keystone.service:public_app_factory
|
||||
|
||||
@@ -58,13 +62,13 @@ paste.app_factory = keystone.service:v3_app_factory
|
||||
paste.app_factory = keystone.service:admin_app_factory
|
||||
|
||||
[pipeline:public_api]
|
||||
-pipeline = access_log sizelimit url_normalize token_auth admin_token_auth xml_body json_body ec2_extension user_crud_extension public_service
|
||||
+pipeline = access_log sizelimit tomograph url_normalize token_auth admin_token_auth xml_body json_body ec2_extension user_crud_extension public_service
|
||||
|
||||
[pipeline:admin_api]
|
||||
-pipeline = access_log sizelimit url_normalize token_auth admin_token_auth xml_body json_body ec2_extension s3_extension crud_extension admin_service
|
||||
+pipeline = access_log sizelimit tomograph url_normalize token_auth admin_token_auth xml_body json_body ec2_extension s3_extension crud_extension admin_service
|
||||
|
||||
[pipeline:api_v3]
|
||||
-pipeline = access_log sizelimit url_normalize token_auth admin_token_auth xml_body json_body ec2_extension s3_extension service_v3
|
||||
+pipeline = access_log sizelimit tomograph url_normalize token_auth admin_token_auth xml_body json_body ec2_extension s3_extension service_v3
|
||||
|
||||
[app:public_version_service]
|
||||
paste.app_factory = keystone.service:public_version_app_factory
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -0,0 +1,34 @@
|
||||
From 6a4cda35bd19f1fd7e7d988fed592951f28801aa Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Fri, 11 Oct 2013 12:30:52 +0300
|
||||
Subject: [PATCH 2/3] Added sql tracing
|
||||
|
||||
---
|
||||
keystone/openstack/common/db/sqlalchemy/session.py | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/keystone/openstack/common/db/sqlalchemy/session.py b/keystone/openstack/common/db/sqlalchemy/session.py
|
||||
index d28227d..d8de7bf 100644
|
||||
--- a/keystone/openstack/common/db/sqlalchemy/session.py
|
||||
+++ b/keystone/openstack/common/db/sqlalchemy/session.py
|
||||
@@ -245,6 +245,7 @@ import functools
|
||||
import os.path
|
||||
import re
|
||||
import time
|
||||
+import tomograph
|
||||
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
@@ -569,6 +570,9 @@ def get_engine(sqlite_fk=False, slave_engine=False):
|
||||
if engine is None:
|
||||
engine = create_engine(db_uri,
|
||||
sqlite_fk=sqlite_fk)
|
||||
+ if engine.name != 'sqlite':
|
||||
+ sqlalchemy.event.listen(engine, 'before_execute', tomograph.before_execute('nova'))
|
||||
+ sqlalchemy.event.listen(engine, 'after_execute', tomograph.after_execute('nova'))
|
||||
if slave_engine:
|
||||
_SLAVE_ENGINE = engine
|
||||
else:
|
||||
--
|
||||
1.8.1.2
|
||||
|
132
openstack-patches/master/keystone/0003-Added-RPC-trace.patch
Normal file
132
openstack-patches/master/keystone/0003-Added-RPC-trace.patch
Normal file
@ -0,0 +1,132 @@
|
||||
From 191eaa443ad858511d0476ef103bb5276e4d99d4 Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <akornienko@mirantis.com>
|
||||
Date: Fri, 23 Aug 2013 12:39:59 +0300
|
||||
Subject: [PATCH 3/3] Added RPC trace
|
||||
|
||||
Change-Id: I4b602abdf766df57217da2c705f05ff0cb6afe55
|
||||
---
|
||||
keystone/openstack/common/rpc/__init__.py | 9 +++++++++
|
||||
keystone/openstack/common/rpc/amqp.py | 10 ++++++++--
|
||||
2 files changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/keystone/openstack/common/rpc/__init__.py b/keystone/openstack/common/rpc/__init__.py
|
||||
index 248a745..3588ed6 100644
|
||||
--- a/keystone/openstack/common/rpc/__init__.py
|
||||
+++ b/keystone/openstack/common/rpc/__init__.py
|
||||
@@ -27,6 +27,8 @@ For some wrappers that add message versioning to rpc, see:
|
||||
|
||||
import inspect
|
||||
|
||||
+import tomograph
|
||||
+
|
||||
from oslo.config import cfg
|
||||
|
||||
from keystone.openstack.common.gettextutils import _ # noqa
|
||||
@@ -137,6 +139,7 @@ def call(context, topic, msg, timeout=None, check_for_lock=False):
|
||||
"""
|
||||
if check_for_lock:
|
||||
_check_for_lock()
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().call(CONF, context, topic, msg, timeout)
|
||||
|
||||
|
||||
@@ -155,6 +158,7 @@ def cast(context, topic, msg):
|
||||
|
||||
:returns: None
|
||||
"""
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().cast(CONF, context, topic, msg)
|
||||
|
||||
|
||||
@@ -176,6 +180,7 @@ def fanout_cast(context, topic, msg):
|
||||
|
||||
:returns: None
|
||||
"""
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().fanout_cast(CONF, context, topic, msg)
|
||||
|
||||
|
||||
@@ -210,6 +215,7 @@ def multicall(context, topic, msg, timeout=None, check_for_lock=False):
|
||||
"""
|
||||
if check_for_lock:
|
||||
_check_for_lock()
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().multicall(CONF, context, topic, msg, timeout)
|
||||
|
||||
|
||||
@@ -224,6 +230,7 @@ def notify(context, topic, msg, envelope=False):
|
||||
|
||||
:returns: None
|
||||
"""
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().notify(cfg.CONF, context, topic, msg, envelope)
|
||||
|
||||
|
||||
@@ -252,6 +259,7 @@ def cast_to_server(context, server_params, topic, msg):
|
||||
|
||||
:returns: None
|
||||
"""
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().cast_to_server(CONF, context, server_params, topic,
|
||||
msg)
|
||||
|
||||
@@ -268,6 +276,7 @@ def fanout_cast_to_server(context, server_params, topic, msg):
|
||||
|
||||
:returns: None
|
||||
"""
|
||||
+ msg['trace_info'] = tomograph.get_trace_info()
|
||||
return _get_impl().fanout_cast_to_server(CONF, context, server_params,
|
||||
topic, msg)
|
||||
|
||||
diff --git a/keystone/openstack/common/rpc/amqp.py b/keystone/openstack/common/rpc/amqp.py
|
||||
index 3bcedbd..d7ae97a 100644
|
||||
--- a/keystone/openstack/common/rpc/amqp.py
|
||||
+++ b/keystone/openstack/common/rpc/amqp.py
|
||||
@@ -28,6 +28,8 @@ AMQP, but is deprecated and predates this code.
|
||||
import collections
|
||||
import inspect
|
||||
import sys
|
||||
+import socket
|
||||
+import tomograph
|
||||
import uuid
|
||||
|
||||
from eventlet import greenpool
|
||||
@@ -417,15 +419,16 @@ class ProxyCallback(_ThreadPoolWithWait):
|
||||
args = message_data.get('args', {})
|
||||
version = message_data.get('version')
|
||||
namespace = message_data.get('namespace')
|
||||
+ trace_info = message_data.get('trace_info', None)
|
||||
if not method:
|
||||
LOG.warn(_('no method for message: %s') % message_data)
|
||||
ctxt.reply(_('No method for message: %s') % message_data,
|
||||
connection_pool=self.connection_pool)
|
||||
return
|
||||
self.pool.spawn_n(self._process_data, ctxt, version, method,
|
||||
- namespace, args)
|
||||
+ namespace, args, trace_info)
|
||||
|
||||
- def _process_data(self, ctxt, version, method, namespace, args):
|
||||
+ def _process_data(self, ctxt, version, method, namespace, args, trace_info):
|
||||
"""Process a message in a new thread.
|
||||
|
||||
If the proxy object we have has a dispatch method
|
||||
@@ -434,6 +437,7 @@ class ProxyCallback(_ThreadPoolWithWait):
|
||||
the old behavior of magically calling the specified method on the
|
||||
proxy we have here.
|
||||
"""
|
||||
+ tomograph.start("rpc", str(method), socket.gethostname(), 0, trace_info)
|
||||
ctxt.update_store()
|
||||
try:
|
||||
rval = self.proxy.dispatch(ctxt, version, method, namespace,
|
||||
@@ -458,6 +462,8 @@ class ProxyCallback(_ThreadPoolWithWait):
|
||||
LOG.error(_('Exception during message handling'),
|
||||
exc_info=exc_info)
|
||||
ctxt.reply(None, exc_info, connection_pool=self.connection_pool)
|
||||
+ finally:
|
||||
+ tomograph.stop(str(method))
|
||||
|
||||
|
||||
class MulticallProxyWaiter(object):
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -0,0 +1,32 @@
|
||||
From f319e1f01fa8566d3076755741ea54d5eeda6005 Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Fri, 4 Oct 2013 10:47:10 +0300
|
||||
Subject: [PATCH] Added trace header forwarding
|
||||
|
||||
---
|
||||
cinderclient/client.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/cinderclient/client.py b/cinderclient/client.py
|
||||
index 4846e4a..b893c1a 100644
|
||||
--- a/cinderclient/client.py
|
||||
+++ b/cinderclient/client.py
|
||||
@@ -45,6 +45,7 @@ if not hasattr(urlparse, 'parse_qsl'):
|
||||
urlparse.parse_qsl = cgi.parse_qsl
|
||||
|
||||
import requests
|
||||
+import tomograph
|
||||
|
||||
from cinderclient import exceptions
|
||||
from cinderclient import service_catalog
|
||||
@@ -167,6 +168,7 @@ class HTTPClient(object):
|
||||
if not self.management_url or not self.auth_token:
|
||||
self.authenticate()
|
||||
kwargs.setdefault('headers', {})['X-Auth-Token'] = self.auth_token
|
||||
+ tomograph.add_trace_info_header(kwargs['headers'])
|
||||
if self.projectid:
|
||||
kwargs['headers']['X-Auth-Project-Id'] = self.projectid
|
||||
try:
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -0,0 +1,32 @@
|
||||
From ecbd4c4b2a1e6bb1331eda834b3087ce1e34d808 Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Fri, 4 Oct 2013 10:49:26 +0300
|
||||
Subject: [PATCH] Added trace header forwarding
|
||||
|
||||
---
|
||||
glanceclient/common/http.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
|
||||
index 4cd66ec..1fa2d17 100644
|
||||
--- a/glanceclient/common/http.py
|
||||
+++ b/glanceclient/common/http.py
|
||||
@@ -21,6 +21,7 @@ import logging
|
||||
import socket
|
||||
import StringIO
|
||||
import struct
|
||||
+import tomograph
|
||||
import urlparse
|
||||
|
||||
try:
|
||||
@@ -172,6 +173,7 @@ class HTTPClient(object):
|
||||
# Copy the kwargs so we can reuse the original in case of redirects
|
||||
kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {}))
|
||||
kwargs['headers'].setdefault('User-Agent', USER_AGENT)
|
||||
+ tomograph.add_trace_info_header(kwargs['headers'])
|
||||
if self.auth_token:
|
||||
kwargs['headers'].setdefault('X-Auth-Token', self.auth_token)
|
||||
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 54495c5db007ceb31d6c1af1fd461e4025015d67 Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Tue, 8 Oct 2013 10:57:33 +0300
|
||||
Subject: [PATCH] Added trace header forwarding
|
||||
|
||||
---
|
||||
keystoneclient/httpclient.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py
|
||||
index dc500db..2dc3b82 100644
|
||||
--- a/keystoneclient/httpclient.py
|
||||
+++ b/keystoneclient/httpclient.py
|
||||
@@ -23,6 +23,7 @@ OpenStack Client interface. Handles the REST calls and responses.
|
||||
|
||||
import copy
|
||||
import logging
|
||||
+import tomograph
|
||||
import urlparse
|
||||
|
||||
import requests
|
||||
@@ -643,6 +644,7 @@ class HTTPClient(object):
|
||||
url_to_use = self.management_url
|
||||
|
||||
kwargs.setdefault('headers', {})
|
||||
+ tomograph.add_trace_info_header(kwargs['headers'])
|
||||
if self.auth_token:
|
||||
kwargs['headers']['X-Auth-Token'] = self.auth_token
|
||||
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 3cec56665a5720d0a70f00cadf0dc2daa2a85408 Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Fri, 4 Oct 2013 10:53:54 +0300
|
||||
Subject: [PATCH] Added trace header forwarding
|
||||
|
||||
---
|
||||
neutronclient/client.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/neutronclient/client.py b/neutronclient/client.py
|
||||
index c1ba8c4..e887c5f 100644
|
||||
--- a/neutronclient/client.py
|
||||
+++ b/neutronclient/client.py
|
||||
@@ -21,6 +21,7 @@ except ImportError:
|
||||
import simplejson as json
|
||||
import logging
|
||||
import os
|
||||
+import tomograph
|
||||
import urlparse
|
||||
# Python 2.5 compat fix
|
||||
if not hasattr(urlparse, 'parse_qsl'):
|
||||
@@ -122,6 +123,7 @@ class HTTPClient(httplib2.Http):
|
||||
kargs = {}
|
||||
kargs.setdefault('headers', kwargs.get('headers', {}))
|
||||
kargs['headers']['User-Agent'] = self.USER_AGENT
|
||||
+ tomograph.add_trace_info_header(kwargs['headers'])
|
||||
|
||||
if 'content_type' in kwargs:
|
||||
kargs['headers']['Content-Type'] = kwargs['content_type']
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 2f4382f0d22639c433029dc2a797a60cdaeddd2e Mon Sep 17 00:00:00 2001
|
||||
From: Alexei Kornienko <alexei.kornienko@gmail.com>
|
||||
Date: Fri, 4 Oct 2013 10:51:19 +0300
|
||||
Subject: [PATCH] Added trace header forwarding
|
||||
|
||||
---
|
||||
novaclient/client.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/novaclient/client.py b/novaclient/client.py
|
||||
index ad594dd..3125f4d 100644
|
||||
--- a/novaclient/client.py
|
||||
+++ b/novaclient/client.py
|
||||
@@ -10,6 +10,7 @@ OpenStack Client interface. Handles the REST calls and responses.
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
+import tomograph
|
||||
|
||||
import requests
|
||||
|
||||
@@ -206,6 +207,7 @@ class HTTPClient(object):
|
||||
# re-authenticate and try again. If it still fails, bail.
|
||||
try:
|
||||
kwargs.setdefault('headers', {})['X-Auth-Token'] = self.auth_token
|
||||
+ tomograph.add_trace_info_header(kwargs['headers'])
|
||||
if self.projectid:
|
||||
kwargs['headers']['X-Auth-Project-Id'] = self.projectid
|
||||
|
||||
--
|
||||
1.8.1.2
|
||||
|
Loading…
Reference in New Issue
Block a user