Bug 1883733

Summary: Gnocchi API 500 Error with 'TypeError: keys must be a string'
Product: Red Hat OpenStack Reporter: Masayuki Igawa <migawa>
Component: gnocchiAssignee: Martin Magr <mmagr>
Status: CLOSED ERRATA QA Contact: Leonid Natapov <lnatapov>
Severity: high Docs Contact:
Priority: high    
Version: 16.1 (Train)CC: apevec, astupnik, jjoyce, jschluet, lhh, lmadsen, michal.vasko, mrunge, pkilambi
Target Milestone: z4Keywords: Triaged, ZStream
Target Release: 16.1 (Train on RHEL 8.2)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gnocchi-4.3.5-1.20201113135944.8cbc9ee.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-17 15:32:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Masayuki Igawa 2020-09-30 04:43:09 UTC
Description of problem:
When executing `openstack metric status`, "500 Internal Server Error" occurs.


Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. Execute command: `openstack metric status`

Actual results:
"500 Internal Server Error" occurs.

Expected results:
No error occurs.

Additional info:
It seems this is the same issue of this.
https://bugs.launchpad.net/charm-gnocchi/+bug/1789947

And this should be fixed with this commit in the upstream.
https://github.com/gnocchixyz/gnocchi/commit/7a3ddc4ceb64bf648a5f383814632f72b8700a8f

Comment 4 Martin Magr 2020-11-02 16:35:00 UTC
The reason why this is happening that some of the keys of pecan processed object contains bytes keys instead of string. For example: 

{'storage': {'summary': {'metrics': 0, 'measures': 0}}, 'metricd': {'processors': {b'controller-0.1.bb4bb372-f148-4320-8ad0-31314d26909e', b'controller-1.0.e9852552-9ada-4eb9-a625-3df110e2d38e', b'controller-2.0.3099a52a-18eb-4989-b239-9e69aabcc70c', b'controller-1.1.a55b8603-281d-4afd-8ac4-a575db1ba0a1', b'controller-0.0.5799e281-63b6-48c2-9a0a-86d0ca8400ab', b'controller-2.1.4789b143-337b-49ef-b0e1-6b697c8dff96'}, 'statistics': {b'controller-0.1.bb4bb372-f148-4320-8ad0-31314d26909e': {}, b'controller-1.0.e9852552-9ada-4eb9-a625-3df110e2d38e': {}, b'controller-2.0.3099a52a-18eb-4989-b239-9e69aabcc70c': {}, b'controller-1.1.a55b8603-281d-4afd-8ac4-a575db1ba0a1': {}, b'controller-0.0.5799e281-63b6-48c2-9a0a-86d0ca8400ab': {}, b'controller-2.1.4789b143-337b-49ef-b0e1-6b697c8dff96': {}}}}

We will need to either find out how to avoid using bytes as object keys or teach pecan how to convert keys to string.

Comment 5 Martin Magr 2020-12-09 16:14:24 UTC
*** Bug 1904092 has been marked as a duplicate of this bug. ***

Comment 10 Leonid Natapov 2021-01-25 17:11:09 UTC
(overcloud) [stack@undercloud-0 ~]$ gnocchi metric list
+--------------------------------------+---------------------+--------------------------------------------+------+--------------------------------------+
| id                                   | archive_policy/name | name                                       | unit | resource_id                          |
+--------------------------------------+---------------------+--------------------------------------------+------+--------------------------------------+
| 050bf4f1-972a-40ac-a059-b44169b907e0 | high                | volume.provider.pool.capacity.free         | GB   | 8311f578-0171-5795-ace5-705877507982 |
| 07585455-edb2-485b-b56b-2dbea5acb192 | high                | volume.provider.capacity.total             | GB   | a0b6f0d6-ac56-5cd1-9398-0ba4bb1271d2 |
| 4eddd433-9fa0-4fa8-a1be-6ec6e387771a | high                | volume.provider.capacity.provisioned       | GB   | a0b6f0d6-ac56-5cd1-9398-0ba4bb1271d2 |
| 7f44596d-a05e-4f78-9dbd-57d4d9489081 | high                | volume.provider.capacity.free              | GB   | a0b6f0d6-ac56-5cd1-9398-0ba4bb1271d2 |
| 87040418-f6f1-45e6-ae4d-52268036e46b | high                | volume.provider.pool.capacity.total        | GB   | 8311f578-0171-5795-ace5-705877507982 |
| a067c2ba-e9b5-4733-8bfa-a1c1dc219b7a | high                | volume.provider.capacity.allocated         | GB   | a0b6f0d6-ac56-5cd1-9398-0ba4bb1271d2 |
| a137590f-f7d0-47bd-bae2-2b0da08709df | high                | volume.provider.capacity.virtual_free      | GB   | a0b6f0d6-ac56-5cd1-9398-0ba4bb1271d2 |
| deef33a1-2c18-4b89-8ac9-2ddec8797c68 | high                | volume.provider.pool.capacity.provisioned  | GB   | 8311f578-0171-5795-ace5-705877507982 |
| e0ad945d-3bb0-4d24-8668-320edc7e71c7 | high                | volume.provider.pool.capacity.virtual_free | GB   | 8311f578-0171-5795-ace5-705877507982 |
| f5b591b1-9828-486d-a7a0-86ad447e9fd3 | high                | volume.provider.pool.capacity.allocated    | GB   | 8311f578-0171-5795-ace5-705877507982 |
+--------------------------------------+---------------------+--------------------------------------------+------+--------------------------------------+
(overcloud) [stack@undercloud-0 ~]$

Comment 18 errata-xmlrpc 2021-03-17 15:32:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform 16.1.4 director bug fix advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:0817