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'}¶
- 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.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:
Driver
- get_report(base_id)[source]¶
Retrieves and parses notification from Elasticsearch.
- 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)[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.
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:
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.
- 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'¶
- class osprofiler.drivers.loginsight.LogInsightDriver(connection_str, project=None, service=None, host=None, **kwargs)[source]¶
Bases:
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
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:
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.
osprofiler.drivers.mongodb module¶
- class osprofiler.drivers.mongodb.MongoDB(connection_str, db_name='osprofiler', project=None, service=None, host=None, **kwargs)[source]¶
Bases:
Driver
- get_report(base_id)[source]¶
Retrieves and parses notification from MongoDB.
- 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)[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.
osprofiler.drivers.otlp module¶
- class osprofiler.drivers.otlp.OTLP(connection_str, project=None, service=None, host=None, conf=<oslo_config.cfg.ConfigOpts object>, **kwargs)[source]¶
Bases:
Driver
- create_span_tags(payload)[source]¶
Create tags an OpenTracing compatible 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.
- 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(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.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:
Driver
- get_report(base_id)[source]¶
Retrieves and parses notification from Redis.
- 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)[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.
osprofiler.drivers.sqlalchemy_driver module¶
- class osprofiler.drivers.sqlalchemy_driver.SQLAlchemyDriver(connection_str, project=None, service=None, host=None, **kwargs)[source]¶
Bases:
Driver
- get_report(base_id)[source]¶
Forms and returns report composed from the stored notifications.
- Parameters:
base_id – Base id of trace elements.