Alerting Plugins (#93)
* Alert Plugin Signed-off-by: Arnav Das <[email protected]> * lint file header license Signed-off-by: Arnav Das <[email protected]> * Tests For Alerting[Monitors] Signed-off-by: Arnav Das <[email protected]> * Tests For Alerting[Destinations] Signed-off-by: Arnav Das <[email protected]> * dynamic lookup 90#issuecomment-1003396742 Signed-off-by: Arnav Das <[email protected]> * Alerting Async Signed-off-by: Arnav Das <[email protected]> * Lint Changes Signed-off-by: Arnav Das <[email protected]> * alerting plugins integration tests Signed-off-by: Arnav Das <[email protected]> * Integ UnitTests Skip on OPENSEARCH_VERSION >= 2.0.0 Signed-off-by: Arnav Das <[email protected]> * Unit Test Skip Complete Signed-off-by: Arnav Das <[email protected]> * License Headers fixed Signed-off-by: Arnav Das <[email protected]> * test_urllib3_connection timeout Signed-off-by: Arnav Das <[email protected]> * lint Signed-off-by: Arnav Das <[email protected]> * Fix licenses in all files Signed-off-by: Harsha Vamsi Kalluri <[email protected]> * Remove elastic search licenses on new files Signed-off-by: Harsha Vamsi Kalluri <[email protected]> * Fix formatting Signed-off-by: Harsha Vamsi Kalluri <[email protected]> Signed-off-by: Arnav Das <[email protected]> Signed-off-by: Harsha Vamsi Kalluri <[email protected]> Co-authored-by: Harsha Vamsi Kalluri <[email protected]>
This commit is contained in:
co-authored by
Harsha Vamsi Kalluri
parent
9398975f98
commit
2d03dc773b
@@ -0,0 +1,54 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# The OpenSearch Contributors require contributions made to
|
||||
# this file be licensed under the Apache-2.0 license or a
|
||||
# compatible open source license.
|
||||
#
|
||||
# Modifications Copyright OpenSearch Contributors. See
|
||||
# GitHub history for details.
|
||||
|
||||
|
||||
import warnings
|
||||
|
||||
from ..plugins.alerting import AlertingClient
|
||||
from .utils import NamespacedClient
|
||||
|
||||
|
||||
class PluginsClient(NamespacedClient):
|
||||
def __init__(self, client):
|
||||
super(PluginsClient, self).__init__(client)
|
||||
# self.query_workbench = QueryWorkbenchClient(client)
|
||||
# self.reporting = ReportingClient(client)
|
||||
# self.notebooks = NotebooksClient(client)
|
||||
self.alerting = AlertingClient(client)
|
||||
# self.anomaly_detection = AnomalyDetectionClient(client)
|
||||
# self.trace_analytics = TraceAnalyticsClient(client)
|
||||
# self.index_management = IndexManagementClient(client)
|
||||
# self.security = SecurityClient(client)
|
||||
|
||||
self._dynamic_lookup(client)
|
||||
|
||||
def _dynamic_lookup(self, client):
|
||||
# Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742
|
||||
|
||||
plugins = [
|
||||
# "query_workbench",
|
||||
# "reporting",
|
||||
# "notebooks",
|
||||
"alerting",
|
||||
# "anomaly_detection",
|
||||
# "trace_analytics",
|
||||
# "index_management",
|
||||
# "security"
|
||||
]
|
||||
for plugin in plugins:
|
||||
if not hasattr(client, plugin):
|
||||
setattr(client, plugin, getattr(self, plugin))
|
||||
else:
|
||||
warnings.warn(
|
||||
"Cannot load `{plugin}` directly to OpenSearch. `{plugin}` already exists in OpenSearch. Please use `OpenSearch.plugin.{plugin}` instead.".format(
|
||||
plugin=plugin
|
||||
),
|
||||
category=RuntimeWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
Reference in New Issue
Block a user