46 Commits

Author SHA1 Message Date
cda93078a0 Update master for stable/2025.1
Add file to the reno documentation build to show release notes for
stable/2025.1.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/2025.1.

Sem-Ver: feature
Change-Id: I005754805de73b36d0b0ca184bda0e3fd9850098
2025-03-08 03:15:09 +00:00
Takashi Kajinami
33657191fb Ignore false-positive E231 error
... and refactor the logic to generate request url.

Change-Id: Ic39b7b70a3a1260e0dc281408ba49f8b9ec21c47
2025-03-08 12:14:04 +09:00
Takashi Kajinami
df6c253a6c Fix release note build
Change-Id: Ibc63e2d79705cecddcf6a4e03a341f8eeb233cd7
0.4.0
2024-10-24 18:49:45 +09:00
Takashi Kajinami
219eb9c7c1 Remove Python 3.8 support
Python 3.8 was removed from the tested runtimes for 2024.2[1] and has
not been tested since then.

Also add Python 3.12 which is part of the tested runtimes for 2025.1.
Now unit tests job with Python 3.12 is voting.

[1] https://governance.openstack.org/tc/reference/runtimes/2024.2.html

Change-Id: Ieca74d9e800b15b5da681a1bf270e2252de22399
2024-10-24 18:40:27 +09:00
Takashi Kajinami
ea9cefce25 Use requirements.txt solely to manage dependencies
... to follow the standard method to manage dependencies. Also apply
global upper constraints to use the consistent dependencies.

Note that releasenotes target is still broken at this stage and needs
further work.

Change-Id: I8dfc5f1b621010364567e241c9e619c710faa6af
2024-10-24 18:40:07 +09:00
Alfredo Moralejo
4b6419c637 Add stestr as test requirement
It's required after [1].

https: //review.opendev.org/c/openstack/python-observabilityclient/+/917542
Change-Id: Ia975ebbcbbfe41b92fccdccdc50799d59c8fdf2a
2024-07-08 15:38:28 +02:00
Takashi Kajinami
e64b943b77 Drop direct usage of simplejson
simplejson is not in requirements so is not install automatically.
The requests library uses the built-in json module instead of the 3rd-
party simplejson library in case the simplejson library is not present.
We should use the alias (requests.JsonDecodeError) instead of
the actual exception from underlying modules to adapt to that
selection logic.

Also remove duplicated code in __str__ and __repr__. The logic in
__repr__ does not contain handling for non-json response and looks
incomplete.

Change-Id: I89749eebc1e410f023169a115ffbfa9ef04cf3ad
0.3.0
2024-05-25 13:52:32 +00:00
Zuul
1557000041 Merge "Drop unused --dev and --messy" 2024-05-24 17:06:46 +00:00
Zuul
ac307dbba0 Merge "Remove unused test dependencies" 2024-05-23 16:48:59 +00:00
Jaromir Wysoglad
dbe02725cb Use stestr for testing
The CI is currently blocked because of using pytest directly.
This patch unblocks the CI.

Change-Id: I7f5b84e5100aef7f8453f6b6f613bf03468074b3
2024-04-30 04:39:22 -04:00
Zuul
0dea42c1e1 Merge "Remove AUTHORS file" 0.2.0 2024-04-10 16:42:11 +00:00
Jaromir Wysoglad
3dcd00ad33 Sort column order in cli output
Change-Id: Ie2db01d02483cf6767d5d54159ebf203e20dd2c5
2024-04-10 02:13:13 -04:00
Jaromir Wysoglad
ed042e2b16 Fix table formatter
It's possible for Prometheus to return multiple metrics, where
each of them has different labels. Before this the client
would fail with error when using the default table formatter,
because of for example:

Row has incorrect number of values, (actual) 8!=9 (expected)

It was also possible to mismatch the label keys and values
for some of the rows.

This patch makes sure the label values are matched to the correct
keys. It also makes sure it uses all labels and it fills
missing values with empty strings for metrics, which don't have
that label defined.

Example table output:
+------------+----------+------------+----------------+-------+
| group      | __name__ | job        | instance       | value |
+------------+----------+------------+----------------+-------+
|            | up       | sg-core    | localhost:3000 | 1     |
| production | up       | prometheus | localhost:9090 | 1     |
+------------+----------+------------+----------------+-------+

Example json output:
[
  {
    "__name__": "up",
    "group": "",
    "job": "sg-core",
    "instance": "localhost:3000",
    "value": "1"
  },
  {
    "__name__": "up",
    "group": "production",
    "job": "prometheus",
    "instance": "localhost:9090",
    "value": "1"
  }
]

Change-Id: Id0dfabf52fe0a21194c498f4aefa1bff1d3eeea9
2024-03-21 05:05:48 -04:00
Takashi Kajinami
42534aee13 Remove unused test dependencies
Change-Id: I987adf66b2764102ffb8fb8241968dc9ee3c73df
2024-03-12 22:08:11 +09:00
Takashi Kajinami
637de9424c Remove AUTHORS file
This file is generated automatically by pbr and is not needed to be
maintained as an actual file.

Change-Id: I7677b16373226469ae0013965da04e6ebc3829b6
2024-03-12 22:08:10 +09:00
Jaromir Wysoglad
6047081ec1 Add TLS support.
This adds a new config option: "prometheus_ca_cert". If this
option is set, then it forces the client to use https to access
prometheus and it uses the specified ca cert to verify the
prometheus' certificate.

Change-Id: Iccb911a590d5b3b9a4c6ac08c4d020641c8094a9
2024-02-26 08:17:08 -05:00
Takashi Kajinami
f3ea3bf603 Drop unused --dev and --messy
These arguments are defined but are not at all used in any logic.

Ideally these should be deprecated, but this library is still in
pre-1.0 phase so I'd propose dropping these immediately.

Change-Id: I1872f0b2fbfc76f17497dfb6d1eacb60f9e1457a
2024-01-10 23:57:06 +09:00
Ghanshyam Mann
9607ee26ce Update python classifier in setup.cfg
As per the current release tested runtime, we test
python version from 3.8 to 3.11 so updating the
same in python classifier in setup.cfg

Change-Id: Id2acb5c79be3ce14fa3ed5978a714e0c94f7e37e
0.1.1
2024-01-04 01:11:20 -08:00
Jaromir Wysoglad
e8961fdf62 Add functional tests
This adds new functional tests, which are supposed to be run
on devstack with a running instance of prometheus.
It tests all of the cli commands as well as all the functions
exposed in the python client.

These tests could be included into the telemetry-dsvm-integration
jobs in the future to use the same devstack vm.

Change-Id: Ibd6deec559465bf3cb7480681b816f55bdf9010e
2023-11-15 05:54:41 -05:00
Jaromir Wysoglad
75fcc4b4e9 Fix cli commands
Something must have changed either with cliff or
with a different version of python. All of the
cli commands end with: "'Namespace' object is not subscriptable"
This is caused because of how the parsed_args fields
were accessed.

This patch addresses the issue. Now it accesses the fields
the same way as aodhclient does. The unit tests for cli
now use the arg parser to actually test this.

During this I also discovered incorrect mocking in the
configuration tests. I added another mock to the test cases
which were missing it.

Change-Id: Ib5dbbdb48bdfd3214ec76acc4c68649e25f695db
2023-11-14 09:33:14 +00:00
Jaromir Wysoglad
d0b868db94 Add i18n.py and use it in v1/base.py and v1/cli.py
This follow similar pattern as other repositories like ceilometer.

Change-Id: Id9abda5720bd93d7fe68ee10deb124bdb665a430
2023-11-08 02:28:00 -05:00
Jaromir Wysoglad
74d9094e5e Fix "_" is shadowing Python builtin
This patch removes openstack-tox-pep8 job dependencies
on flake8-*. The only dependency for that job right now
is hacking, which is the same as in other repositories like
ceilometer, python-aodhclient, python-glanceclient.

Change-Id: I08bd18171f00d023c6f3f3c64d18f03032a6af96
2023-11-08 02:24:02 -05:00
Erno Kuvaja
5746f69ddc Flake8 changes
Adding comments for all ignores and extensions.
Adding extensions from OpenStack Hacking.
Fixing few breakages of those added extensions.

Change-Id: Idacee2ca555411e33b65817fb9245d130cf36574
2023-10-18 12:23:49 +01:00
Jaromír Wysoglad
305a10397c Remove .github/
After moving the repository from github, we no longer need the
.github/ folder

Change-Id: I217caebc1b59a7394cdc54110afd75138f490238
2023-10-16 15:16:34 +00:00
Jaromir Wysoglad
26687730b3 Fix zuul testing
This change fixes python 3.8 unit tests.
Unfortunately using grouping parentheses in with statements
is a python 3.9+ feature. I had to replace the parentheses
with a less elegant "\" to escape continuation lines.

I also included a .zuul.yaml, without which this couldn't
get merged and a .gitreview for convinience.

The telemetry-dsvm-* tests are non-voting for now.
There isn't any relevant test for this repositary
there as of right now,
those will get added in the next few weeks. And
unfortunately all the telemetry-dsvm-* tests fail
due to pyparsing version mismatch right now.
Once I or anyone else adds relevant tests to the
telemetry tempest plugin, we can make the tests
voting here.

Co-authored-by: Martin Magr <mmagr@redhat.com>
Co-authored-by: Erno Kuvaja <jokke@usr.fi>
Change-Id: Icc7b0229bca0664ee7fd60e3932df8f599beb500
0.1.0
2023-10-16 09:02:34 -04:00
Jaromír Wysoglad
53b335aaca
Add automated unit testing and a set of tests (#9)
* Add unit testing

* Fix code according to CI

This includes:
  - formating changes
  - rewording of some doc strings
  - adding support to {label!~'value'} in rbac

* Add unit tests automation

* Fix CI automation

* Add requirements.txt
2023-09-05 14:54:33 +02:00
Martin Mágr
037437e995 Fix setup.cfg 0.0.4 2023-08-04 16:12:59 +02:00
Martin Mágr
86f4f08260 PyPI dist (#8) 2023-08-04 16:10:35 +02:00
Martin Mágr
57cd295545
PyPI dist (#8) 0.0.3 2023-08-04 14:25:09 +02:00
Jaromír Wysoglad
a580772449
Prometheus interaction (#7)
* Remove old observability client

* Add initial functionality for prometheus querying

* Fix a copy-paste error in get_client()

* Add additional functionality.

This commit adds:
    - commands:
        delete
        clear-tombstones
        snapshot
    - Better rbac injection as well as a possibility
      to disable rbac.
    - Configuration of prometheus_client through
      env variables and /etc/openstack/prometheus.yaml

* Make README up to date

* Implement Martin's PR comments

* Implement better support for label values in rbac

* PEP8
0.0.2
2023-08-03 15:30:19 +02:00
Leif Madsen
3f8acf0574
Merge pull request #2 from paramite/flex-inventory
Allow inventory overrides
2022-12-31 13:42:58 -05:00
Chris Sibbitt
183b738462
Merge pull request #6 from infrawatch/csibbitt-update-readme-for-security
Update README to reflect new params file changes
2022-12-20 12:04:31 -05:00
Chris Sibbitt
7ba473e706
Update README.md 2022-12-06 12:48:07 -05:00
Chris Sibbitt
51fde08069
Update README to reflect new params file changes
Should merge with https://github.com/infrawatch/osp-observability-ansible/pull/18
2022-12-06 12:44:53 -05:00
Leif Madsen
17a148d931
Merge pull request #3 from infrawatch/basic_docs
Basic set of docs
2022-12-02 14:25:15 -05:00
Chris Sibbitt
58975106f8 Removing README.rst 2022-12-02 13:52:35 -05:00
Chris Sibbitt
379d6c9dc7
Merge branch 'master' into basic_docs 2022-12-02 13:51:21 -05:00
Chris Sibbitt
61b1e74ba8 Merging additions from my notes 2022-12-02 13:50:17 -05:00
Chris Sibbitt
a5b8fb7680
Fixed missing comma 2022-12-01 13:35:54 -05:00
Leif Madsen
60463d6737
Merge pull request #4 from infrawatch/license
Add Apachev2 license file
0.0.1
2022-11-23 08:49:52 -05:00
Leif Madsen
62c8dc1c91 Update license file 2022-11-23 08:49:25 -05:00
Leif Madsen
0f7d6c099b Basic set of docs
Basic set of docs to get an environment up and running. Sparse on
details, but wanted to capture the core elements. I wrote this in
markdown since that's what I know. Can convert to reStructuredText in a
separate commit if necessary.
2022-11-01 23:01:54 -04:00
Martin Mágr
cb7cfe2f54 Missing piece 2022-11-01 16:43:39 +01:00
Martin Mágr
82cb579cc6 Allow inventory overrides
For deploy.discovery command:
  This patch allows inventory file destination fallback override and adds
  additional fallback paths used by standalone deployment.

For deploy.setup command:
  This patch allows to override usage of generated inventory file.
2022-11-01 16:37:57 +01:00
Martin Mágr
5f523534fa
Initial functionality (#1)
This patch adds basic functionality of the plugin. It successfully registers as openstackclient plugin and contains two basic observability commands:

   - discover
      - prepares ansible inventory file with overcloud and undercloud nodes and gather data for prometheus agent according to which nodes are scrapable
   - setup
      - starts proper ansible playbook based on component (currently only prometheus_agent is available)

Co-authored-by: Marihan Girgis mgirgisf@redhat.com
Partially-Implements: OSP-14664
Related: infrawatch/osp-observability-ansible#11
2022-10-26 17:00:11 +02:00
Martin Mágr
7ad72695a3 Initial commit 2022-04-25 13:02:34 +02:00