Initialize notifier from service configuration
conf – service configuration
context – request context
project – project name (keystone, cinder etc.)
service – service name that will be profiled
host – hostname or host IP address that the service will be running on.
kwargs – other arguments for notifier creation
Create notifier based on specified plugin_name
connection_string – connection string which specifies the storage driver for notifier
args – args that will be passed to the driver’s __init__ method
kwargs – kwargs that will be passed to the driver’s __init__ method
Callable notifier method
Bases: type
Metaclass to comfortably trace all children of a specific class.
Possible usage:
>>> class RpcManagerClass(object, metaclass=profiler.TracedMeta):
>>> __trace_args__ = {'name': 'rpc',
>>> 'info': None,
>>> 'hide_args': False,
>>> 'hide_result': True,
>>> 'trace_private': False}
>>>
>>> def my_method(self, some_args):
>>> pass
>>>
>>> def my_method2(self, some_arg1, some_arg2, kw=None, kw2=None)
>>> pass
Adding of this metaclass requires to set __trace_args__ attribute to the class we want to modify. __trace_args__ is the dictionary with one mandatory key included - “name”, that will define name of action to be traced - E.g. wsgi, rpc, db, etc…
Get profiler instance.
Profiler instance or None if profiler wasn’t inited.
Init profiler instance for current thread.
You should call profiler.init() before using osprofiler. Otherwise profiler.start() and profiler.stop() methods won’t do anything.
hmac_key – secret key to sign trace information.
base_id – Used to bind all related traces.
parent_id – Used to build tree of traces.
Profiler instance
Send new start notification if profiler instance is presented.
name – The name of action. E.g. wsgi, rpc, db, etc..
info – Dictionary with extra trace information. For example in wsgi it can be url, in rpc - message or in db sql - request.
Send new stop notification if profiler instance is presented.
Trace decorator for functions.
Very useful if you would like to add trace point on existing function:
>> @profiler.trace(“my_point”) >> def my_func(self, some_args): >> #code
name – The name of action. E.g. wsgi, rpc, db, etc..
info – Dictionary with extra trace information. For example in wsgi it can be url, in rpc - message or in db sql - request.
hide_args – Don’t push to trace info args and kwargs. Quite useful if you have some info in args that you wont to share, e.g. passwords.
hide_result – Boolean value to hide/show function result in trace. True - hide function result (default). False - show function result in trace.
allow_multiple_trace – If the wrapped function has already been traced either allow the new trace to occur or raise a value error denoting that multiple tracing is not allowed (by default allow).
Trace decorator for instances of class .
Very useful if you would like to add trace point on existing method:
>> @profiler.trace_cls(“rpc”) >> RpcManagerClass(object): >> >> def my_method(self, some_args): >> pass >> >> def my_method2(self, some_arg1, some_arg2, kw=None, kw2=None) >> pass >>
name – The name of action. E.g. wsgi, rpc, db, etc..
info – Dictionary with extra trace information. For example in wsgi it can be url, in rpc - message or in db sql - request.
hide_args – Don’t push to trace info args and kwargs. Quite useful if you have some info in args that you wont to share, e.g. passwords.
hide_result – Boolean value to hide/show function result in trace. True - hide function result (default). False - show function result in trace.
trace_private – Trace methods that starts with “_”. It wont trace methods that starts “__” even if it is turned on.
trace_static_methods – Trace staticmethods. This may be prone to issues so careful usage is recommended (this is also why this defaults to false).
trace_class_methods – Trace classmethods. This may be prone to issues so careful usage is recommended (this is also why this defaults to false).
allow_multiple_trace – If wrapped attributes have already been traced either allow the new trace to occur or raise a value error denoting that multiple tracing is not allowed (by default allow).
Add tracing to all sqlalchemy calls.
Bases: object
WSGI Middleware that enables tracing for an application.
Http header that will contain the traces data hmac (that will be validated).
Http header that will contain the needed traces data.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.