osprofiler.drivers package

osprofiler.drivers package

Submodules

osprofiler.drivers.base module

class osprofiler.drivers.base.Driver(connection_str, project=None, service=None, host=None, **kwargs)[source]

Bases: object

Base Driver class.

This class provides protected common methods that do not rely on a specific storage backend. Public methods notify() and/or get_report(), which require using storage backend API, must be overridden and implemented by any class derived from this class.

default_trace_fields = {'base_id', 'timestamp'}
classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Forms and returns report composed from the stored notifications.

Parameters

base_id – Base id of trace elements.

list_error_traces()[source]

Query all error traces from the storage.

:return List of traces, where each trace is a dictionary containing

base_id and timestamp.

list_traces(fields=None)[source]

Query all traces from the storage.

Parameters

fields – Set of trace fields to return. Defaults to ‘base_id’ and ‘timestamp’

Returns

List of traces, where each trace is a dictionary containing at least base_id and timestamp.

notify(info, **kwargs)[source]

This method will be called on each notifier.notify() call.

To add new drivers you should, create new subclass of this class and implement notify method.

Parameters

info – Contains information about trace element. In payload dict there are always 3 ids: “base_id” - uuid that is common for all notifications related to one trace. Used to simplify retrieving of all trace elements from the backend. “parent_id” - uuid of parent element in trace “trace_id” - uuid of current element in trace With parent_id and trace_id it’s quite simple to build tree of trace elements, which simplify analyze of trace.

osprofiler.drivers.base.get_driver(connection_string, *args, **kwargs)[source]

Create driver’s instance according to specified connection string

osprofiler.drivers.elasticsearch_driver module

class osprofiler.drivers.elasticsearch_driver.ElasticsearchDriver(connection_str, index_name='osprofiler-notifications', project=None, service=None, host=None, conf=<oslo_config.cfg.ConfigOpts object>, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Retrieves and parses notification from Elasticsearch.

Parameters

base_id – Base id of trace elements.

list_error_traces()[source]

Returns all traces that have error/exception.

list_traces(fields=None)[source]

Query all traces from the storage.

Parameters

fields – Set of trace fields to return. Defaults to ‘base_id’ and ‘timestamp’

Returns

List of traces, where each trace is a dictionary containing at least base_id and timestamp.

notify(info)[source]

Send notifications to Elasticsearch.

Parameters

info – Contains information about trace element. In payload dict there are always 3 ids: “base_id” - uuid that is common for all notifications related to one trace. Used to simplify retrieving of all trace elements from Elasticsearch. “parent_id” - uuid of parent element in trace “trace_id” - uuid of current element in trace With parent_id and trace_id it’s quite simple to build tree of trace elements, which simplify analyze of trace.

notify_error_trace(info)[source]

Store base_id and timestamp of error trace to a separate index.

osprofiler.drivers.jaeger module

class osprofiler.drivers.jaeger.Jaeger(connection_str, project=None, service=None, host=None, conf=<oslo_config.cfg.ConfigOpts object>, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

create_span_tags(payload)[source]

Create tags for OpenTracing span.

Parameters

info – Information from OSProfiler trace.

Returns tags

A dictionary contains standard tags from OpenTracing sematic conventions, and some other custom tags related to http, db calls.

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Please use Jaeger Tracing UI for this task.

list_error_traces()[source]

Please use Jaeger Tracing UI for this task.

list_traces(fields=None)[source]

Please use Jaeger Tracing UI for this task.

notify(payload)[source]

This method will be called on each notifier.notify() call.

To add new drivers you should, create new subclass of this class and implement notify method.

Parameters

info – Contains information about trace element. In payload dict there are always 3 ids: “base_id” - uuid that is common for all notifications related to one trace. Used to simplify retrieving of all trace elements from the backend. “parent_id” - uuid of parent element in trace “trace_id” - uuid of current element in trace With parent_id and trace_id it’s quite simple to build tree of trace elements, which simplify analyze of trace.

osprofiler.drivers.loginsight module

Classes to use VMware vRealize Log Insight as the trace data store.

class osprofiler.drivers.loginsight.LogInsightClient(host, username, password, api_port=9000, api_ssl_port=9543, query_timeout=60000)[source]

Bases: object

A minimal Log Insight client.

CURRENT_SESSIONS_PATH = 'api/v1/sessions/current'
EVENTS_INGEST_PATH = 'api/v1/events/ingest/F52D775B-6017-4787-8C8A-F21AE0AEC057'
LI_OSPROFILER_AGENT_ID = 'F52D775B-6017-4787-8C8A-F21AE0AEC057'
QUERY_EVENTS_BASE_PATH = 'api/v1/events'
SESSIONS_PATH = 'api/v1/sessions'
login()[source]
query_events(params)[source]
send_event(event)[source]
class osprofiler.drivers.loginsight.LogInsightDriver(connection_str, project=None, service=None, host=None, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

Driver for storing trace data in VMware vRealize Log Insight.

The driver uses Log Insight ingest service to store trace data and uses the query service to retrieve it. The minimum required Log Insight version is 3.3.

The connection string to initialize the driver should be of the format: loginsight://<username>:<password>@<loginsight-host>

If the username or password contains the character ‘:’ or ‘@’, it must be escaped using URL encoding. For example, the connection string to connect to Log Insight server at 10.1.2.3 using username “osprofiler” and password “p@ssword” is: loginsight://osprofiler:p%40ssword@10.1.2.3

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Retrieves and parses trace data from Log Insight.

Parameters

base_id – Trace base ID

notify(info)[source]

Send trace to Log Insight server.

osprofiler.drivers.messaging module

class osprofiler.drivers.messaging.Messaging(connection_str, project=None, service=None, host=None, context=None, conf=None, transport_url=None, idle_timeout=1, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Forms and returns report composed from the stored notifications.

Parameters

base_id – Base id of trace elements.

notify(info, context=None)[source]

Send notifications to backend via oslo.messaging notifier API.

Parameters
  • info – Contains information about trace element. In payload dict there are always 3 ids: “base_id” - uuid that is common for all notifications related to one trace. “parent_id” - uuid of parent element in trace “trace_id” - uuid of current element in trace With parent_id and trace_id it’s quite simple to build tree of trace elements, which simplify analyze of trace.

  • context – request context that is mostly used to specify current active user and tenant.

class osprofiler.drivers.messaging.NotifyEndpoint(oslo_messaging, base_id)[source]

Bases: object

get_last_read_time()[source]
get_messages()[source]
info(ctxt, publisher_id, event_type, payload, metadata)[source]
exception osprofiler.drivers.messaging.SignalExit[source]

Bases: BaseException

osprofiler.drivers.messaging.signal_handler(signum, frame, state)[source]

osprofiler.drivers.mongodb module

class osprofiler.drivers.mongodb.MongoDB(connection_str, db_name='osprofiler', project=None, service=None, host=None, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Retrieves and parses notification from MongoDB.

Parameters

base_id – Base id of trace elements.

list_error_traces()[source]

Returns all traces that have error/exception.

list_traces(fields=None)[source]

Query all traces from the storage.

Parameters

fields – Set of trace fields to return. Defaults to ‘base_id’ and ‘timestamp’

Returns

List of traces, where each trace is a dictionary containing at least base_id and timestamp.

notify(info)[source]

Send notifications to MongoDB.

Parameters

info – Contains information about trace element. In payload dict there are always 3 ids: “base_id” - uuid that is common for all notifications related to one trace. Used to simplify retrieving of all trace elements from MongoDB. “parent_id” - uuid of parent element in trace “trace_id” - uuid of current element in trace With parent_id and trace_id it’s quite simple to build tree of trace elements, which simplify analyze of trace.

notify_error_trace(data)[source]

Store base_id and timestamp of error trace to a separate db.

osprofiler.drivers.redis_driver module

class osprofiler.drivers.redis_driver.Redis(connection_str, db=0, project=None, service=None, host=None, conf=<oslo_config.cfg.ConfigOpts object>, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Retrieves and parses notification from Redis.

Parameters

base_id – Base id of trace elements.

list_error_traces()[source]

Returns all traces that have error/exception.

list_traces(fields=None)[source]

Query all traces from the storage.

Parameters

fields – Set of trace fields to return. Defaults to ‘base_id’ and ‘timestamp’

Returns

List of traces, where each trace is a dictionary containing at least base_id and timestamp.

notify(info)[source]

Send notifications to Redis.

Parameters

info – Contains information about trace element. In payload dict there are always 3 ids: “base_id” - uuid that is common for all notifications related to one trace. Used to simplify retrieving of all trace elements from Redis. “parent_id” - uuid of parent element in trace “trace_id” - uuid of current element in trace With parent_id and trace_id it’s quite simple to build tree of trace elements, which simplify analyze of trace.

notify_error_trace(data)[source]

Store base_id and timestamp of error trace to a separate key.

class osprofiler.drivers.redis_driver.RedisSentinel(connection_str, db=0, project=None, service=None, host=None, conf=<oslo_config.cfg.ConfigOpts object>, **kwargs)[source]

Bases: osprofiler.drivers.redis_driver.Redis, osprofiler.drivers.base.Driver

classmethod get_name()[source]

Returns backend specific name for the driver.

osprofiler.drivers.sqlalchemy_driver module

class osprofiler.drivers.sqlalchemy_driver.SQLAlchemyDriver(connection_str, project=None, service=None, host=None, **kwargs)[source]

Bases: osprofiler.drivers.base.Driver

classmethod get_name()[source]

Returns backend specific name for the driver.

get_report(base_id)[source]

Forms and returns report composed from the stored notifications.

Parameters

base_id – Base id of trace elements.

list_traces(fields=None)[source]

Query all traces from the storage.

Parameters

fields – Set of trace fields to return. Defaults to ‘base_id’ and ‘timestamp’

Returns

List of traces, where each trace is a dictionary containing at least base_id and timestamp.

notify(info, context=None)[source]

Write a notification the the database

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.