deep.api.plugin
Load and handle plugins.
DEEP_PLUGINS = ['deep.api.plugin.otel.OTelPlugin', 'deep.api.plugin.python.PythonPlugin', 'deep.api.plugin.metric.prometheus_metrics.PrometheusPlugin', 'deep.api.plugin.metric.otel_metrics.OTelMetrics']
module-attribute
System provided default plugins.
DidNotEnable
Bases: Exception
Raised when failed to load plugin.
The plugin could not be enabled due to a trivial user error like
otel
not being installed for the OTelPlugin
.
Plugin
Bases: ABC
A deep Plugin.
This type defines a plugin for deep, these plugins allow for extensions to how deep decorates data.
Source code in deep/api/plugin/__init__.py
name
property
The name of the plugin.
__init__(name=None, config=None)
Create a new plugin.
:param name: the name of the plugin (default to class name) :param config: the deep config service
Source code in deep/api/plugin/__init__.py
is_active()
Is the plugin active.
Check the value of the config element plugin_{name}. If it is set to 'False' this plugin is not active.
Source code in deep/api/plugin/__init__.py
order()
Order of precedence when multiple versions of providers are available.
Order=1 will run after a provider with order=0.
:return: the provider order
ResourceProvider
Bases: Plugin
, ABC
Implement this to have the plugin provide resource attributes to Deep.
Source code in deep/api/plugin/__init__.py
SnapshotDecorator
Bases: Plugin
, ABC
Implement this to decorate collected snapshots with attributes.
Source code in deep/api/plugin/__init__.py
decorate(snapshot_id, context)
abstractmethod
Decorate a snapshot with additional data.
:param snapshot_id: the id of the collected snapshot :param context: the action context for this action
:return: the additional attributes to attach
Source code in deep/api/plugin/__init__.py
TracepointLogger
Bases: Plugin
, ABC
This defines how a tracepoint logger should interact with Deep.
This can be registered with Deep to provide customization to the way Deep will log dynamic log messages injected via tracepoints.
Source code in deep/api/plugin/__init__.py
log_tracepoint(log_msg, tp_id, ctx_id)
abstractmethod
Log the dynamic log message.
:param (str) log_msg: the log message to log :param (str) tp_id: the id of the tracepoint that generated this log :param (str) ctx_id: the id of the context that was created by this tracepoint
Source code in deep/api/plugin/__init__.py
load_plugins(config, custom=None)
Load all the deep plugins.
Attempt to load each plugin, if successful merge an attributes list of each plugin.
:return: the loaded plugins and attributes.