python-observabilityclient 1.2.0__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- observabilityclient/plugin.py +3 -3
- observabilityclient/prometheus_client.py +2 -2
- observabilityclient/rbac.py +2 -3
- observabilityclient/tests/functional/base.py +1 -1
- observabilityclient/tests/unit/test_cli.py +1 -1
- observabilityclient/tests/unit/test_prometheus_client.py +4 -4
- observabilityclient/tests/unit/test_python_api.py +1 -1
- observabilityclient/tests/unit/test_rbac.py +1 -1
- observabilityclient/tests/unit/test_utils.py +9 -9
- observabilityclient/utils/metric_utils.py +3 -3
- observabilityclient/v1/base.py +1 -1
- observabilityclient/v1/client.py +1 -1
- observabilityclient/v1/python_api.py +1 -1
- python_observabilityclient-1.3.0.dist-info/METADATA +93 -0
- python_observabilityclient-1.3.0.dist-info/RECORD +31 -0
- {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.3.0.dist-info}/WHEEL +1 -1
- {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.3.0.dist-info}/entry_points.txt +3 -0
- {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.3.0.dist-info/licenses}/AUTHORS +1 -0
- python_observabilityclient-1.3.0.dist-info/pbr.json +1 -0
- python_observabilityclient-1.2.0.dist-info/METADATA +0 -83
- python_observabilityclient-1.2.0.dist-info/RECORD +0 -31
- python_observabilityclient-1.2.0.dist-info/pbr.json +0 -1
- {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.3.0.dist-info/licenses}/LICENSE +0 -0
- {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.3.0.dist-info}/top_level.txt +0 -0
observabilityclient/plugin.py
CHANGED
|
@@ -59,7 +59,7 @@ def build_option_parser(parser):
|
|
|
59
59
|
parser.add_argument(
|
|
60
60
|
'--os-observability-api-version',
|
|
61
61
|
metavar='<observability-api-version>',
|
|
62
|
-
help='Observability Plugin API version, default='
|
|
63
|
-
+
|
|
64
|
-
|
|
62
|
+
help='Observability Plugin API version, default=' +
|
|
63
|
+
DEFAULT_API_VERSION +
|
|
64
|
+
' (Env: OS_OSCPLUGIN_API_VERSION)')
|
|
65
65
|
return parser
|
|
@@ -45,14 +45,14 @@ class PrometheusAPIClientError(Exception):
|
|
|
45
45
|
return self.__str__()
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
class PrometheusMetric
|
|
48
|
+
class PrometheusMetric:
|
|
49
49
|
def __init__(self, input):
|
|
50
50
|
self.timestamp = input['value'][0]
|
|
51
51
|
self.labels = input['metric']
|
|
52
52
|
self.value = input['value'][1]
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
class PrometheusAPIClient
|
|
55
|
+
class PrometheusAPIClient:
|
|
56
56
|
def __init__(self, host, session=None, root_path=""):
|
|
57
57
|
self._host = host
|
|
58
58
|
if not self._host.endswith('/'):
|
observabilityclient/rbac.py
CHANGED
|
@@ -17,7 +17,7 @@ import re
|
|
|
17
17
|
from observabilityclient.utils.metric_utils import format_labels
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class PromQLRbac
|
|
20
|
+
class PromQLRbac:
|
|
21
21
|
def __init__(self, prom_api_client, project_id, project_label='project'):
|
|
22
22
|
self.client = prom_api_client
|
|
23
23
|
|
|
@@ -40,8 +40,7 @@ class PromQLRbac(object):
|
|
|
40
40
|
|
|
41
41
|
def _find_label_value_end(self, query, start, quote_char):
|
|
42
42
|
end = start
|
|
43
|
-
while (end == start or
|
|
44
|
-
query[end - 1] == '\\'):
|
|
43
|
+
while (end == start or query[end - 1] == '\\'):
|
|
45
44
|
# Looking for first unescaped quotes
|
|
46
45
|
end = query.find(quote_char, end + 1)
|
|
47
46
|
# returns the quote position or -1
|
|
@@ -58,23 +58,23 @@ class MetricListMatcher(testtools.Matcher):
|
|
|
58
58
|
|
|
59
59
|
class PrometheusAPIClientTestBase(testtools.TestCase):
|
|
60
60
|
def setUp(self):
|
|
61
|
-
super(
|
|
61
|
+
super().setUp()
|
|
62
62
|
|
|
63
|
-
class GoodResponse
|
|
63
|
+
class GoodResponse:
|
|
64
64
|
def __init__(self):
|
|
65
65
|
self.status_code = 200
|
|
66
66
|
|
|
67
67
|
def json(self):
|
|
68
68
|
return {"status": "success"}
|
|
69
69
|
|
|
70
|
-
class BadResponse
|
|
70
|
+
class BadResponse:
|
|
71
71
|
def __init__(self):
|
|
72
72
|
self.status_code = 500
|
|
73
73
|
|
|
74
74
|
def json(self):
|
|
75
75
|
return {"status": "error", "error": "test_error"}
|
|
76
76
|
|
|
77
|
-
class NoContentResponse
|
|
77
|
+
class NoContentResponse:
|
|
78
78
|
def __init__(self):
|
|
79
79
|
self.status_code = 204
|
|
80
80
|
|
|
@@ -26,7 +26,7 @@ from observabilityclient.v1 import python_api
|
|
|
26
26
|
|
|
27
27
|
class QueryManagerTest(testtools.TestCase):
|
|
28
28
|
def setUp(self):
|
|
29
|
-
super(
|
|
29
|
+
super().setUp()
|
|
30
30
|
self.client = mock.Mock()
|
|
31
31
|
prom_client = prometheus_client.PrometheusAPIClient("somehost")
|
|
32
32
|
self.client.prometheus_client = prom_client
|
|
@@ -21,7 +21,7 @@ from observabilityclient import rbac
|
|
|
21
21
|
|
|
22
22
|
class PromQLRbacTest(testtools.TestCase):
|
|
23
23
|
def setUp(self):
|
|
24
|
-
super(
|
|
24
|
+
super().setUp()
|
|
25
25
|
self.project_id = "project123"
|
|
26
26
|
self.rbac = rbac.PromQLRbac(mock.Mock(), mock.Mock())
|
|
27
27
|
self.rbac.labels = {
|
|
@@ -25,20 +25,20 @@ from observabilityclient.utils import metric_utils
|
|
|
25
25
|
|
|
26
26
|
class GetConfigFileTest(testtools.TestCase):
|
|
27
27
|
def setUp(self):
|
|
28
|
-
super(
|
|
28
|
+
super().setUp()
|
|
29
29
|
|
|
30
30
|
def test_current_dir(self):
|
|
31
31
|
with mock.patch.object(os.path, 'exists', return_value=True), \
|
|
32
32
|
mock.patch.object(metric_utils, 'open') as m:
|
|
33
33
|
metric_utils.get_config_file()
|
|
34
|
-
m.assert_called_with(metric_utils.CONFIG_FILE_NAME
|
|
34
|
+
m.assert_called_with(metric_utils.CONFIG_FILE_NAME)
|
|
35
35
|
|
|
36
36
|
def test_path_order(self):
|
|
37
37
|
expected = [mock.call(metric_utils.CONFIG_FILE_NAME, 'r'),
|
|
38
|
-
mock.call(
|
|
39
|
-
|
|
40
|
-
mock.call(
|
|
41
|
-
|
|
38
|
+
mock.call(f"{os.environ['HOME']}/.config/openstack/"
|
|
39
|
+
f"{metric_utils.CONFIG_FILE_NAME}"),
|
|
40
|
+
mock.call(f"/etc/openstack/"
|
|
41
|
+
f"{metric_utils.CONFIG_FILE_NAME}")]
|
|
42
42
|
with mock.patch.object(os.path, 'exists', return_value=False) as m:
|
|
43
43
|
ret = metric_utils.get_config_file()
|
|
44
44
|
m.call_args_list == expected
|
|
@@ -47,7 +47,7 @@ class GetConfigFileTest(testtools.TestCase):
|
|
|
47
47
|
|
|
48
48
|
class GetPrometheusClientTest(testtools.TestCase):
|
|
49
49
|
def setUp(self):
|
|
50
|
-
super(
|
|
50
|
+
super().setUp()
|
|
51
51
|
config_data = 'host: "somehost"\nport: "1234"'
|
|
52
52
|
self.config_file = mock.mock_open(read_data=config_data)("name", 'r')
|
|
53
53
|
|
|
@@ -185,7 +185,7 @@ class GetPrometheusClientTest(testtools.TestCase):
|
|
|
185
185
|
|
|
186
186
|
class FormatLabelsTest(testtools.TestCase):
|
|
187
187
|
def setUp(self):
|
|
188
|
-
super(
|
|
188
|
+
super().setUp()
|
|
189
189
|
|
|
190
190
|
def test_format_labels_with_normal_labels(self):
|
|
191
191
|
input_dict = {"label_key1": "label_value1",
|
|
@@ -206,7 +206,7 @@ class FormatLabelsTest(testtools.TestCase):
|
|
|
206
206
|
|
|
207
207
|
class Metrics2ColsTest(testtools.TestCase):
|
|
208
208
|
def setUp(self):
|
|
209
|
-
super(
|
|
209
|
+
super().setUp()
|
|
210
210
|
|
|
211
211
|
def test_metrics2cols(self):
|
|
212
212
|
metric = {
|
|
@@ -40,12 +40,12 @@ class ConfigurationError(Exception):
|
|
|
40
40
|
def get_config_file():
|
|
41
41
|
if os.path.exists(CONFIG_FILE_NAME):
|
|
42
42
|
LOG.debug("Using %s as prometheus configuration", CONFIG_FILE_NAME)
|
|
43
|
-
return open(CONFIG_FILE_NAME
|
|
43
|
+
return open(CONFIG_FILE_NAME)
|
|
44
44
|
for path in DEFAULT_CONFIG_LOCATIONS:
|
|
45
45
|
full_filename = path + CONFIG_FILE_NAME
|
|
46
46
|
if os.path.exists(full_filename):
|
|
47
47
|
LOG.debug("Using %s as prometheus configuration", full_filename)
|
|
48
|
-
return open(full_filename
|
|
48
|
+
return open(full_filename)
|
|
49
49
|
return None
|
|
50
50
|
|
|
51
51
|
|
|
@@ -154,7 +154,7 @@ def format_labels(d: dict) -> str:
|
|
|
154
154
|
|
|
155
155
|
ret = ""
|
|
156
156
|
for key, value in d.items():
|
|
157
|
-
ret += "{}='{}', "
|
|
157
|
+
ret += f"{key}='{value}', "
|
|
158
158
|
ret = ret[0:-2]
|
|
159
159
|
old = ""
|
|
160
160
|
while ret != old:
|
observabilityclient/v1/base.py
CHANGED
observabilityclient/v1/client.py
CHANGED
|
@@ -19,7 +19,7 @@ from observabilityclient.utils.metric_utils import get_prometheus_client
|
|
|
19
19
|
from observabilityclient.v1 import python_api
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
class Client
|
|
22
|
+
class Client:
|
|
23
23
|
"""Client for the observabilityclient api."""
|
|
24
24
|
|
|
25
25
|
def __init__(self, session=None, adapter_options=None,
|
|
@@ -31,7 +31,7 @@ class QueryManager(base.Manager):
|
|
|
31
31
|
metrics = self.prom.series(match)
|
|
32
32
|
if metrics == []:
|
|
33
33
|
return []
|
|
34
|
-
unique_metric_names = list(
|
|
34
|
+
unique_metric_names = list({m['__name__'] for m in metrics})
|
|
35
35
|
return sorted(unique_metric_names)
|
|
36
36
|
|
|
37
37
|
def show(self, name, disable_rbac=True):
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-observabilityclient
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: OpenStack Observability Client
|
|
5
|
+
Author-email: OpenStack <openstack-discuss@lists.openstack.org>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Environment :: OpenStack
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Information Technology
|
|
11
|
+
Classifier: Intended Audience :: System Administrators
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown; charset=UTF-8
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: AUTHORS
|
|
25
|
+
Requires-Dist: osc-lib>=1.0.1
|
|
26
|
+
Requires-Dist: keystoneauth1>=1.0.0
|
|
27
|
+
Requires-Dist: cliff>=1.14.0
|
|
28
|
+
Requires-Dist: PyYAML>5.1
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: requires-dist
|
|
31
|
+
|
|
32
|
+
==========================
|
|
33
|
+
python-observabilityclient
|
|
34
|
+
==========================
|
|
35
|
+
|
|
36
|
+
.. image:: https://governance.openstack.org/tc/badges/python-observabilityclient.svg
|
|
37
|
+
|
|
38
|
+
.. Change things from this point on
|
|
39
|
+
|
|
40
|
+
observabilityclient is an OpenStackClient (OSC) plugin implementation that
|
|
41
|
+
implements commands for management of Prometheus.
|
|
42
|
+
|
|
43
|
+
-----------
|
|
44
|
+
Development
|
|
45
|
+
-----------
|
|
46
|
+
|
|
47
|
+
Install your OpenStack environment and patch your ``openstack`` client
|
|
48
|
+
application using python.
|
|
49
|
+
|
|
50
|
+
.. code:: console
|
|
51
|
+
git clone https://opendev.org/openstack/python-observabilityclient.git
|
|
52
|
+
cd python-observabilityclient
|
|
53
|
+
sudo pip install .
|
|
54
|
+
|
|
55
|
+
-----
|
|
56
|
+
Usage
|
|
57
|
+
-----
|
|
58
|
+
|
|
59
|
+
Use ``openstack metric query somequery`` to query for metrics in prometheus.
|
|
60
|
+
|
|
61
|
+
To use the python api do the following:
|
|
62
|
+
|
|
63
|
+
.. code:: python
|
|
64
|
+
from observabilityclient import client
|
|
65
|
+
|
|
66
|
+
c = client.Client(
|
|
67
|
+
'1', keystone_client.get_session(conf),
|
|
68
|
+
adapter_options={
|
|
69
|
+
'interface': conf.service_credentials.interface,
|
|
70
|
+
'region_name': conf.service_credentials.region_name})
|
|
71
|
+
c.query.query("somequery")
|
|
72
|
+
|
|
73
|
+
----------------
|
|
74
|
+
List of commands
|
|
75
|
+
----------------
|
|
76
|
+
|
|
77
|
+
* ``openstack metric list`` - lists all metrics
|
|
78
|
+
* ``openstack metric show`` - shows current values of a metric
|
|
79
|
+
* ``openstack metric query`` - queries prometheus and outputs the result
|
|
80
|
+
* ``openstack metric delete`` - deletes some metrics
|
|
81
|
+
* ``openstack metric snapshot`` - takes a snapshot of the current data
|
|
82
|
+
* ``openstack metric clean-tombstones`` - cleans the tsdb tombstones
|
|
83
|
+
|
|
84
|
+
------------------------------------------------
|
|
85
|
+
List of functions provided by the python library
|
|
86
|
+
------------------------------------------------
|
|
87
|
+
|
|
88
|
+
* ``c.query.list`` - lists all metrics
|
|
89
|
+
* ``c.query.show`` - shows current values of a metric
|
|
90
|
+
* ``c.query.query`` - queries prometheus and outputs the result
|
|
91
|
+
* ``c.query.delete`` - deletes some metrics
|
|
92
|
+
* ``c.query.snapshot`` - takes a snapshot of the current data
|
|
93
|
+
* ``c.query.clean-tombstones`` - cleans the tsdb tombstones
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
observabilityclient/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
observabilityclient/client.py,sha256=cfRb816p6Ips9t2cdWvmSJ1uGrtTEHXQnctoExrLA5A,828
|
|
3
|
+
observabilityclient/i18n.py,sha256=PFo6BaOfyGQD5q7L3FunYJ8d4mwbRszG8wOrJIjki_4,790
|
|
4
|
+
observabilityclient/plugin.py,sha256=fxUDNvo_2UrG_tM-IsgBNWAKCrWwvixhqbWt0QktH4A,2262
|
|
5
|
+
observabilityclient/prometheus_client.py,sha256=__TPtWPqrU-DPjEbkoNmmu3VMgwbsj0rxz8sPUXyU4g,7416
|
|
6
|
+
observabilityclient/rbac.py,sha256=b71bi0Ls6lUBL3RE1az5ih98DiPMoqF43SPgQkosSqE,7807
|
|
7
|
+
observabilityclient/tests/functional/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
observabilityclient/tests/functional/base.py,sha256=FZT3C50z199-7SwgeGEMzxHLnbPqqB4GcHWbdobDLb8,6493
|
|
9
|
+
observabilityclient/tests/functional/test_cli.py,sha256=jwhgt8w0gq1CdDoaDKLV8SB_hQRmgnbMw9rRIyfcZLo,3944
|
|
10
|
+
observabilityclient/tests/functional/test_python_api.py,sha256=5TLFboJ7B__UZ9zfc6bVSxPTzV9KnnrwluTqLwnTZLs,3308
|
|
11
|
+
observabilityclient/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
observabilityclient/tests/unit/test_cli.py,sha256=Li3QNEp6mWC758aEVL0yC6JUXv2KKtYgDfWfGLPg4xo,6178
|
|
13
|
+
observabilityclient/tests/unit/test_prometheus_client.py,sha256=nMgCNSdoXuAYIhh3FokQMjCWFxXP6FfS5iNG0xQNQPI,18925
|
|
14
|
+
observabilityclient/tests/unit/test_python_api.py,sha256=cgpBwRR9KsCzfKC8OhE8Gm4OCirEobYnXDlK6e_4io4,4719
|
|
15
|
+
observabilityclient/tests/unit/test_rbac.py,sha256=88mAxgOiTnKDrOGqb3Kt1SiqyeC4voYmDvvkWT1kVhw,8992
|
|
16
|
+
observabilityclient/tests/unit/test_utils.py,sha256=IEBG0nfOKS_i_4r5N0Hobw7yr-sxakT5DR6BJMbCWVI,12338
|
|
17
|
+
observabilityclient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
observabilityclient/utils/metric_utils.py,sha256=JsZSUQ4971cNPkZ0gj3ChUQ3VA8g13RqNJk6jAyOmdI,5779
|
|
19
|
+
observabilityclient/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
observabilityclient/v1/base.py,sha256=UfrHeow54fkJ1tWCNhKieKCPrSg1HiCLxJ_QpUOBb0w,2905
|
|
21
|
+
observabilityclient/v1/cli.py,sha256=ln7GsnbW95n90oFGw4zLiwHDjY0YHBxkRBzID-j6ZmA,4028
|
|
22
|
+
observabilityclient/v1/client.py,sha256=AFJkyvBEPvYAKIH-55BGiac8Z73Iasg3Q56NPEk11hc,1747
|
|
23
|
+
observabilityclient/v1/python_api.py,sha256=GA5R5BezVbdT-Mnl9Nmg3kAlUuFl5sLrENlRQHXz_Vs,3886
|
|
24
|
+
python_observabilityclient-1.3.0.dist-info/licenses/AUTHORS,sha256=GkuiTpI2rAHpiqeEGkTOrYuKIIz0MefU7M17EuvPLTQ,597
|
|
25
|
+
python_observabilityclient-1.3.0.dist-info/licenses/LICENSE,sha256=qyh9xnj_IPtYWzClm5mZxCWRKTr2eUP_iLcU28DIvCw,11343
|
|
26
|
+
python_observabilityclient-1.3.0.dist-info/METADATA,sha256=jBY8b4RD8ggY9XqcU-uBOwPG9wom6pTVZWFMAJXFn_Y,3145
|
|
27
|
+
python_observabilityclient-1.3.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
28
|
+
python_observabilityclient-1.3.0.dist-info/entry_points.txt,sha256=tY7BbKFvgnS1krnvXKl5D6JYlJf51T8iymb6RtexObk,472
|
|
29
|
+
python_observabilityclient-1.3.0.dist-info/pbr.json,sha256=KMaaKrar4A3EoAl1zsXlpYsWSbkKWyzBXnsKCosQbmQ,46
|
|
30
|
+
python_observabilityclient-1.3.0.dist-info/top_level.txt,sha256=Lf7Fwm3hfK-X1JNRy19rVlrMUOyQShBBPwsCU3pz6yw,20
|
|
31
|
+
python_observabilityclient-1.3.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "5e7f98b", "is_release": true}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: python-observabilityclient
|
|
3
|
-
Version: 1.2.0
|
|
4
|
-
Summary: OpenStack Observability Client
|
|
5
|
-
Home-page: https://opendev.org/openstack/python-observabilityclient
|
|
6
|
-
Author: OpenStack
|
|
7
|
-
Author-email: openstack-discuss@lists.openstack.org
|
|
8
|
-
License: Apache License, Version 2.0
|
|
9
|
-
Classifier: Environment :: Console
|
|
10
|
-
Classifier: Environment :: OpenStack
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Intended Audience :: Information Technology
|
|
13
|
-
Classifier: Intended Audience :: System Administrators
|
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python
|
|
17
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
-
Requires-Python: >=3.10
|
|
24
|
-
Description-Content-Type: text/markdown; charset=UTF-8
|
|
25
|
-
License-File: LICENSE
|
|
26
|
-
License-File: AUTHORS
|
|
27
|
-
Requires-Dist: osc-lib >=1.0.1
|
|
28
|
-
Requires-Dist: keystoneauth1 >=1.0.0
|
|
29
|
-
Requires-Dist: cliff >=1.14.0
|
|
30
|
-
Requires-Dist: PyYAML >5.1
|
|
31
|
-
|
|
32
|
-
# python-observabilityclient
|
|
33
|
-
|
|
34
|
-
observabilityclient is an OpenStackClient (OSC) plugin implementation that
|
|
35
|
-
implements commands for management of Prometheus.
|
|
36
|
-
|
|
37
|
-
## Development
|
|
38
|
-
|
|
39
|
-
Install your OpenStack environment and patch your `openstack` client application using python.
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
# if using standalone, the following commands come after 'sudo dnf install -y python3-tripleoclient'
|
|
43
|
-
|
|
44
|
-
su - stack
|
|
45
|
-
|
|
46
|
-
# clone and install observability client plugin
|
|
47
|
-
git clone https://opendev.org/openstack/python-observabilityclient.git
|
|
48
|
-
cd python-observabilityclient
|
|
49
|
-
sudo python setup.py install --prefix=/usr
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Usage
|
|
53
|
-
|
|
54
|
-
Use `openstack metric query somequery` to query for metrics in prometheus.
|
|
55
|
-
|
|
56
|
-
To use the python api do the following:
|
|
57
|
-
```
|
|
58
|
-
from observabilityclient import client
|
|
59
|
-
|
|
60
|
-
c = client.Client(
|
|
61
|
-
'1', keystone_client.get_session(conf),
|
|
62
|
-
adapter_options={
|
|
63
|
-
'interface': conf.service_credentials.interface,
|
|
64
|
-
'region_name': conf.service_credentials.region_name})
|
|
65
|
-
c.query.query("somequery")
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## List of commands
|
|
69
|
-
|
|
70
|
-
openstack metric list - lists all metrics
|
|
71
|
-
openstack metric show - shows current values of a metric
|
|
72
|
-
openstack metric query - queries prometheus and outputs the result
|
|
73
|
-
openstack metric delete - deletes some metrics
|
|
74
|
-
openstack metric snapshot - takes a snapshot of the current data
|
|
75
|
-
openstack metric clean-tombstones - cleans the tsdb tombstones
|
|
76
|
-
|
|
77
|
-
## List of functions provided by the python library
|
|
78
|
-
c.query.list - lists all metrics
|
|
79
|
-
c.query.show - shows current values of a metric
|
|
80
|
-
c.query.query - queries prometheus and outputs the result
|
|
81
|
-
c.query.delete - deletes some metrics
|
|
82
|
-
c.query.snapshot - takes a snapshot of the current data
|
|
83
|
-
c.query.clean-tombstones - cleans the tsdb tombstones
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
observabilityclient/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
observabilityclient/client.py,sha256=cfRb816p6Ips9t2cdWvmSJ1uGrtTEHXQnctoExrLA5A,828
|
|
3
|
-
observabilityclient/i18n.py,sha256=PFo6BaOfyGQD5q7L3FunYJ8d4mwbRszG8wOrJIjki_4,790
|
|
4
|
-
observabilityclient/plugin.py,sha256=hyxENjNO6NLrH6G4muyAeEEtFTBa9d5OozjwpzNpJVA,2262
|
|
5
|
-
observabilityclient/prometheus_client.py,sha256=3-ICn_hqcuiZRGh54ysZwI-CncMRyeUefmQx1b5fz54,7432
|
|
6
|
-
observabilityclient/rbac.py,sha256=EudKSx79doqV-2Ka2HraP2ImOOj1ctIno4-rMVI2jqY,7830
|
|
7
|
-
observabilityclient/tests/functional/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
observabilityclient/tests/functional/base.py,sha256=X2KZRKrHQlQf5uMeNERydlIPQYdhjd5LI_MlGfT0oTA,6516
|
|
9
|
-
observabilityclient/tests/functional/test_cli.py,sha256=jwhgt8w0gq1CdDoaDKLV8SB_hQRmgnbMw9rRIyfcZLo,3944
|
|
10
|
-
observabilityclient/tests/functional/test_python_api.py,sha256=5TLFboJ7B__UZ9zfc6bVSxPTzV9KnnrwluTqLwnTZLs,3308
|
|
11
|
-
observabilityclient/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
observabilityclient/tests/unit/test_cli.py,sha256=N19Yo-PIdhlR4-tKQCKbtoetbknxZwl10zsEQSA1Leo,6191
|
|
13
|
-
observabilityclient/tests/unit/test_prometheus_client.py,sha256=iyAypBArQE2e7WGORwhelpoKdNAK1UD2SqZcs6p6ToQ,18982
|
|
14
|
-
observabilityclient/tests/unit/test_python_api.py,sha256=gMUcsvQISESY7p3NWsuoHk07I0phc74c-JC2vKRKfBI,4741
|
|
15
|
-
observabilityclient/tests/unit/test_rbac.py,sha256=sSIw8y8Xgdy6nJm0QW2ImZzyQOOQ24E5S_s7AtHcnQ8,9012
|
|
16
|
-
observabilityclient/tests/unit/test_utils.py,sha256=FbRR056Xr0RUlXYJVDJVAFF6eB9BmNNbCTpzA3sev7I,12445
|
|
17
|
-
observabilityclient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
observabilityclient/utils/metric_utils.py,sha256=AISLI2s1Y7dnQq5aP0BbpczoZIO23hbD_QEpLkqn0Oc,5799
|
|
19
|
-
observabilityclient/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
observabilityclient/v1/base.py,sha256=keRgOIe7_yvE57fJRZ5O6s0GK6N4CqbGwhw24CmiAGE,2913
|
|
21
|
-
observabilityclient/v1/cli.py,sha256=ln7GsnbW95n90oFGw4zLiwHDjY0YHBxkRBzID-j6ZmA,4028
|
|
22
|
-
observabilityclient/v1/client.py,sha256=MPsHTAG3IL_8PD37fbHZnJ_sgCWJyMPO_upEXsiB5D0,1755
|
|
23
|
-
observabilityclient/v1/python_api.py,sha256=niW0NUWKK-Mdli72gWpP_tjGYEFr4RXc5J3giBkIkuA,3891
|
|
24
|
-
python_observabilityclient-1.2.0.dist-info/AUTHORS,sha256=kbZ0J1gr9UzwvCdQ444XzTLrcuzW1hbhHEqY28qN_f0,566
|
|
25
|
-
python_observabilityclient-1.2.0.dist-info/LICENSE,sha256=qyh9xnj_IPtYWzClm5mZxCWRKTr2eUP_iLcU28DIvCw,11343
|
|
26
|
-
python_observabilityclient-1.2.0.dist-info/METADATA,sha256=16eJZFYqp5gUpcFeW48M52Kongoeiqf0I8mY_t7mwL0,2966
|
|
27
|
-
python_observabilityclient-1.2.0.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
28
|
-
python_observabilityclient-1.2.0.dist-info/entry_points.txt,sha256=15rmai80pMRfBKZrk6yPNrRkAs2h63bwlcbQKq9fax4,424
|
|
29
|
-
python_observabilityclient-1.2.0.dist-info/pbr.json,sha256=vlbvTD8gdiSKzRu8OGKteLySLqeGBfHuWuZOJK2TLFo,46
|
|
30
|
-
python_observabilityclient-1.2.0.dist-info/top_level.txt,sha256=Lf7Fwm3hfK-X1JNRy19rVlrMUOyQShBBPwsCU3pz6yw,20
|
|
31
|
-
python_observabilityclient-1.2.0.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "bcadbfe", "is_release": true}
|
|
File without changes
|
|
File without changes
|