This commit is contained in:
Boris Pavlovic 2014-01-12 05:17:04 +04:00
parent aa320244cc
commit d8d94883ef
5 changed files with 7 additions and 6 deletions

View File

@ -16,7 +16,8 @@
class Notifier(object): class Notifier(object):
"""Base notifier that should be implemented by every service that would """Base notifier that should be implemented by every service that would
like to use profiler lib.""" like to use profiler lib.
"""
def notify(self, event_type, payload): def notify(self, event_type, payload):
pass pass

View File

@ -24,7 +24,7 @@ __local_ctx = threading.local()
def init(base_id=None, parent_id=None, service='generic'): def init(base_id=None, parent_id=None, service='generic'):
""" Init profiler. """Init profiler.
:param base_id: Used to bind all related traces. :param base_id: Used to bind all related traces.
:param parent_id: Used to build tree of traces. :param parent_id: Used to build tree of traces.
:param service: Service name that sends traces. :param service: Service name that sends traces.

View File

@ -32,7 +32,7 @@ def before_execute(name):
def after_execute(): def after_execute():
"""Add listener that will send trace info after sql executed.""" """Add listener that will send trace info after sql executed."""
def handler(conn, clauseelement, multiparams, params, result): def handler(conn, clauseelement, multiparams, params, result):
p = profiler.get_profiler() p = profiler.get_profiler()
if p: if p:
p.stop(info={"db.result": str(result)}) p.stop(info={"db.result": str(result)})

View File

@ -12,10 +12,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from osprofiler import test from tests import test
class DummyTestCase(test.TestCase): class DummyTestCase(test.TestCase):
def dummy(self): def test_dummy(self):
self.assertTrue(2 == 2) self.assertTrue(2 == 2)