Fix v1 summary/total with ES/OS storage backend

``metric_types`` is used as a list in ``_build_must``, so we need to
pass ``service`` as a single-itemed list.

Story: 2011128
Task: 50106
Change-Id: I144a005c180ed67a16985f93efa930ddf937c989
This commit is contained in:
Matt Crees 2024-05-15 16:39:50 +01:00
parent 8a5319fd5d
commit 2613a42514
3 changed files with 11 additions and 0 deletions

View File

@ -366,6 +366,8 @@ class ElasticsearchClient(object):
if not paginate: if not paginate:
offset = 0 offset = 0
metric_types = [metric_types] if metric_types else None
must = self._build_must(begin, end, metric_types, filters) must = self._build_must(begin, end, metric_types, filters)
should = self._build_should(filters) should = self._build_should(filters)
composite = self._build_composite(groupby) if groupby else None composite = self._build_composite(groupby) if groupby else None

View File

@ -363,6 +363,8 @@ class OpenSearchClient(object):
if not paginate: if not paginate:
offset = 0 offset = 0
metric_types = [metric_types] if metric_types else None
must = self._build_must(begin, end, metric_types, filters) must = self._build_must(begin, end, metric_types, filters)
should = self._build_should(filters) should = self._build_should(filters)
composite = self._build_composite(groupby) if groupby else None composite = self._build_composite(groupby) if groupby else None

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixed a bug where ``openstack rating summary get -s <service>`` and
``openstack rating total get -s <service>`` would fail when using the
Elasticsearch or OpenSearch storage backends. See story 2011128
<https://storyboard.openstack.org/#!/story/2011128>`_ for more details.