python-observabilityclient 1.2.0__py3-none-any.whl → 1.4.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.
Files changed (24) hide show
  1. observabilityclient/plugin.py +3 -3
  2. observabilityclient/prometheus_client.py +9 -5
  3. observabilityclient/rbac.py +2 -3
  4. observabilityclient/tests/functional/base.py +1 -1
  5. observabilityclient/tests/unit/test_cli.py +1 -1
  6. observabilityclient/tests/unit/test_prometheus_client.py +32 -4
  7. observabilityclient/tests/unit/test_python_api.py +1 -1
  8. observabilityclient/tests/unit/test_rbac.py +1 -1
  9. observabilityclient/tests/unit/test_utils.py +16 -13
  10. observabilityclient/utils/metric_utils.py +5 -9
  11. observabilityclient/v1/base.py +1 -1
  12. observabilityclient/v1/client.py +1 -1
  13. observabilityclient/v1/python_api.py +1 -1
  14. python_observabilityclient-1.4.0.dist-info/METADATA +93 -0
  15. python_observabilityclient-1.4.0.dist-info/RECORD +31 -0
  16. {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.4.0.dist-info}/WHEEL +1 -1
  17. {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.4.0.dist-info/licenses}/AUTHORS +3 -0
  18. python_observabilityclient-1.4.0.dist-info/pbr.json +1 -0
  19. python_observabilityclient-1.2.0.dist-info/METADATA +0 -83
  20. python_observabilityclient-1.2.0.dist-info/RECORD +0 -31
  21. python_observabilityclient-1.2.0.dist-info/pbr.json +0 -1
  22. {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.4.0.dist-info}/entry_points.txt +0 -0
  23. {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.4.0.dist-info/licenses}/LICENSE +0 -0
  24. {python_observabilityclient-1.2.0.dist-info → python_observabilityclient-1.4.0.dist-info}/top_level.txt +0 -0
@@ -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
- + DEFAULT_API_VERSION
64
- + ' (Env: OS_OSCPLUGIN_API_VERSION)')
62
+ help='Observability Plugin API version, default=' +
63
+ DEFAULT_API_VERSION +
64
+ ' (Env: OS_OSCPLUGIN_API_VERSION)')
65
65
  return parser
@@ -45,23 +45,24 @@ class PrometheusAPIClientError(Exception):
45
45
  return self.__str__()
46
46
 
47
47
 
48
- class PrometheusMetric(object):
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(object):
56
- def __init__(self, host, session=None, root_path=""):
55
+ class PrometheusAPIClient:
56
+ def __init__(self, host, session=None, root_path="", scheme=None):
57
+ self._scheme = scheme
57
58
  self._host = host
58
59
  if not self._host.endswith('/'):
59
60
  self._host += '/'
60
61
  if session is None:
61
62
  self._session = requests.Session()
63
+ self._session.verify = False
62
64
  else:
63
65
  self._session = session
64
- self._session.verify = False
65
66
  self._root_path = root_path
66
67
  if root_path != "" and not self._root_path.endswith('/'):
67
68
  self._root_path += '/'
@@ -76,7 +77,10 @@ class PrometheusAPIClient(object):
76
77
  self._session.auth = (auth_user, auth_password)
77
78
 
78
79
  def _get_url(self, endpoint):
79
- scheme = 'https' if self._session.verify else 'http'
80
+ if self._scheme is None:
81
+ scheme = 'https' if self._session.verify else 'http'
82
+ else:
83
+ scheme = self._scheme
80
84
  return f"{scheme}://{self._host}{self._root_path}api/v1/{endpoint}"
81
85
 
82
86
  def _get(self, endpoint, params=None):
@@ -17,7 +17,7 @@ import re
17
17
  from observabilityclient.utils.metric_utils import format_labels
18
18
 
19
19
 
20
- class PromQLRbac(object):
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
@@ -47,7 +47,7 @@ class PythonAPITestCase(testtools.TestCase):
47
47
  return session.Session(auth=auth)
48
48
 
49
49
  def setUp(self):
50
- super(PythonAPITestCase, self).setUp()
50
+ super().setUp()
51
51
  self.client = client.Client(
52
52
  1,
53
53
  self._getKeystoneSession()
@@ -23,7 +23,7 @@ from observabilityclient.v1 import cli
23
23
 
24
24
  class CliTest(testtools.TestCase):
25
25
  def setUp(self):
26
- super(CliTest, self).setUp()
26
+ super().setUp()
27
27
  self.client = mock.Mock()
28
28
  self.client.query = mock.Mock()
29
29
 
@@ -58,23 +58,23 @@ class MetricListMatcher(testtools.Matcher):
58
58
 
59
59
  class PrometheusAPIClientTestBase(testtools.TestCase):
60
60
  def setUp(self):
61
- super(PrometheusAPIClientTestBase, self).setUp()
61
+ super().setUp()
62
62
 
63
- class GoodResponse(object):
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(object):
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(object):
77
+ class NoContentResponse:
78
78
  def __init__(self):
79
79
  self.status_code = 204
80
80
 
@@ -83,6 +83,34 @@ class PrometheusAPIClientTestBase(testtools.TestCase):
83
83
 
84
84
 
85
85
  class PrometheusAPIClientTest(PrometheusAPIClientTestBase):
86
+ def test_init_scheme_default(self):
87
+ c = client.PrometheusAPIClient("localhost:9090")
88
+ self.assertIsNone(c._scheme)
89
+
90
+ def test_init_scheme_passed(self):
91
+ c = client.PrometheusAPIClient("localhost:9090", scheme="https")
92
+ self.assertEqual("https", c._scheme)
93
+
94
+ def test_get_url_without_scheme_uses_verify(self):
95
+ c = client.PrometheusAPIClient("localhost:9090")
96
+ c._session.verify = False
97
+ self.assertEqual("http://localhost:9090/api/v1/query",
98
+ c._get_url("query"))
99
+ c._session.verify = True
100
+ self.assertEqual("https://localhost:9090/api/v1/query",
101
+ c._get_url("query"))
102
+
103
+ def test_get_url_with_scheme_ignores_verify(self):
104
+ c = client.PrometheusAPIClient("localhost:9090", scheme="https")
105
+ c._session.verify = False
106
+ self.assertEqual("https://localhost:9090/api/v1/query",
107
+ c._get_url("query"))
108
+
109
+ c = client.PrometheusAPIClient("localhost:9090", scheme="http")
110
+ c._session.verify = True
111
+ self.assertEqual("http://localhost:9090/api/v1/query",
112
+ c._get_url("query"))
113
+
86
114
  def test_get(self):
87
115
  url = "test"
88
116
  root_path = "root_path"
@@ -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(QueryManagerTest, self).setUp()
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(PromQLRbacTest, self).setUp()
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(GetConfigFileTest, self).setUp()
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, 'r')
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((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}"))]
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(GetPrometheusClientTest, self).setUp()
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
 
@@ -115,7 +115,7 @@ class GetPrometheusClientTest(testtools.TestCase):
115
115
  "set_ca_cert") as ca_m:
116
116
  metric_utils.get_prometheus_client(keystone_session)
117
117
  init_m.assert_called_with(
118
- "localhost:1234", keystone_session, "prometheus"
118
+ "localhost:1234", keystone_session, "prometheus", scheme="http"
119
119
  )
120
120
  ca_m.assert_not_called()
121
121
 
@@ -133,9 +133,11 @@ class GetPrometheusClientTest(testtools.TestCase):
133
133
  "set_ca_cert") as ca_m:
134
134
  metric_utils.get_prometheus_client(keystone_session)
135
135
  init_m.assert_called_with(
136
- "localhost:1234", keystone_session, "prometheus"
136
+ "localhost:1234", keystone_session, "prometheus", scheme="https"
137
137
  )
138
- ca_m.assert_called_with(True)
138
+ # Session transport options (verify/insecure) must be preserved;
139
+ # do not override them based on the endpoint URL scheme.
140
+ ca_m.assert_not_called()
139
141
 
140
142
  def test_get_prometheus_client_from_env_vars_ipv6(self):
141
143
  patched_env = {'PROMETHEUS_HOST': '2607:5300:201:2000::654',
@@ -178,14 +180,15 @@ class GetPrometheusClientTest(testtools.TestCase):
178
180
  "set_ca_cert") as ca_m:
179
181
  metric_utils.get_prometheus_client(keystone_session)
180
182
  init_m.assert_called_with(
181
- "[2607:5300:201:2000::654]:80", keystone_session, "prometheus"
183
+ "[2607:5300:201:2000::654]:80", keystone_session, "prometheus",
184
+ scheme="http"
182
185
  )
183
186
  ca_m.assert_not_called()
184
187
 
185
188
 
186
189
  class FormatLabelsTest(testtools.TestCase):
187
190
  def setUp(self):
188
- super(FormatLabelsTest, self).setUp()
191
+ super().setUp()
189
192
 
190
193
  def test_format_labels_with_normal_labels(self):
191
194
  input_dict = {"label_key1": "label_value1",
@@ -206,7 +209,7 @@ class FormatLabelsTest(testtools.TestCase):
206
209
 
207
210
  class Metrics2ColsTest(testtools.TestCase):
208
211
  def setUp(self):
209
- super(Metrics2ColsTest, self).setUp()
212
+ super().setUp()
210
213
 
211
214
  def test_metrics2cols(self):
212
215
  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, "r")
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, "r")
48
+ return open(full_filename)
49
49
  return None
50
50
 
51
51
 
@@ -59,18 +59,14 @@ def get_prom_client_from_keystone(session, adapter_options=None):
59
59
 
60
60
  escaped_host = netutils.escape_ipv6(parsed_url.hostname)
61
61
  root_path = parsed_url.path.strip('/')
62
- tls = parsed_url.scheme == "https"
63
62
 
64
63
  if parsed_url.port is not None:
65
64
  url = f'{escaped_host}:{parsed_url.port}'
66
65
  else:
67
66
  url = escaped_host
68
67
 
69
- client = PrometheusAPIClient(url, session, root_path)
70
-
71
- if tls:
72
- client.set_ca_cert(True)
73
- return client
68
+ return PrometheusAPIClient(
69
+ url, session, root_path, scheme=parsed_url.scheme)
74
70
 
75
71
 
76
72
  def get_prom_client_from_file_or_env():
@@ -154,7 +150,7 @@ def format_labels(d: dict) -> str:
154
150
 
155
151
  ret = ""
156
152
  for key, value in d.items():
157
- ret += "{}='{}', ".format(key, value)
153
+ ret += f"{key}='{value}', "
158
154
  ret = ret[0:-2]
159
155
  old = ""
160
156
  while ret != old:
@@ -51,7 +51,7 @@ class ObservabilityBaseCommand(command.Command):
51
51
  return parser
52
52
 
53
53
 
54
- class Manager(object):
54
+ class Manager:
55
55
  """Base class for the python api."""
56
56
 
57
57
  DEFAULT_HEADERS = {
@@ -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(object):
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(set([m['__name__'] for m in metrics]))
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.4.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.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Requires-Python: >=3.11
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=bxHGTbdteD7h0JBV7IekTU02bUXFbR_P_R9pXweO-ZE,7548
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=u2te9c8CE5bR6FCI9pYi7jtPsqBiPa2HVshXUQMeYy0,20105
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=xyjMjJIK5ofx9Urx-R39y-q1BPof_y-k-ocXcMOKen4,12529
17
+ observabilityclient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ observabilityclient/utils/metric_utils.py,sha256=Gp7Ai4WzROEDF0txEEPBmMEmuzTy1njU4HJ7TxZt5Vo,5709
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.4.0.dist-info/licenses/AUTHORS,sha256=TZPAY_mWGQ7oo86HOdjZU566EU_vInwz1QWmymMAFw8,678
25
+ python_observabilityclient-1.4.0.dist-info/licenses/LICENSE,sha256=qyh9xnj_IPtYWzClm5mZxCWRKTr2eUP_iLcU28DIvCw,11343
26
+ python_observabilityclient-1.4.0.dist-info/METADATA,sha256=kkB8dx5in8lhrYxx1nevQRjj7Q1lCz5SuogkfNsVI7E,3145
27
+ python_observabilityclient-1.4.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
28
+ python_observabilityclient-1.4.0.dist-info/entry_points.txt,sha256=15rmai80pMRfBKZrk6yPNrRkAs2h63bwlcbQKq9fax4,424
29
+ python_observabilityclient-1.4.0.dist-info/pbr.json,sha256=SpW49bfnvklqlyuRqz3Lv-iLvqR87m6UZCJ9-Q-Bo9U,46
30
+ python_observabilityclient-1.4.0.dist-info/top_level.txt,sha256=Lf7Fwm3hfK-X1JNRy19rVlrMUOyQShBBPwsCU3pz6yw,20
31
+ python_observabilityclient-1.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.2)
2
+ Generator: setuptools (84.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +1,7 @@
1
1
  Alfredo Moralejo <amoralej@redhat.com>
2
2
  Chris Sibbitt <csibbitt@redhat.com>
3
3
  Cyril Roelandt <cyril@redhat.com>
4
+ Emma Foley <efoley@redhat.com>
4
5
  Erno Kuvaja <jokke@usr.fi>
5
6
  Ghanshyam Mann <gmann@ghanshyammann.com>
6
7
  Jaromir Wysoglad <jwysogla@redhat.com>
@@ -11,5 +12,7 @@ Marihan Girgis mgirgisf@redhat.com
11
12
  Martin Magr <mmagr@redhat.com>
12
13
  Martin Mágr <mmagr@redhat.com>
13
14
  OpenStack Release Bot <infra-root@openstack.org>
15
+ Pavlo Shchelokovskyy <shchelokovskyy@gmail.com>
14
16
  Takashi Kajinami <kajinamit@oss.nttdata.com>
17
+ Thomas Goirand <zigo@debian.org>
15
18
  Victoria Martinez de la Cruz <victoria@redhat.com>
@@ -0,0 +1 @@
1
+ {"git_version": "3c745ef", "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}