Bug 1437927 - gnocchi metric doesn't exist error while using metric id with "gnocchi measures"
Summary: gnocchi metric doesn't exist error while using metric id with "gnocchi measures"
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-gnocchi
Version: 10.0 (Newton)
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Mehdi ABAAKOUK
QA Contact: Sasha Smolyak
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-31 12:55 UTC by VIKRANT
Modified: 2017-04-10 16:16 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-10 16:16:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description VIKRANT 2017-03-31 12:55:51 UTC
Description of problem:

Spawned one instance and verified that gnocchi is able to detect the instance.

[root@allinone10 ~(keystone_admin)]# gnocchi resource show --type instance  a6508f68-d8bf-4833-995a-4fc864297875
+-----------------------+----------------------------------------------------------------+
| Field                 | Value                                                          |
+-----------------------+----------------------------------------------------------------+
| created_by_project_id | 530de77464e046ac9f87a69b8d4291ff                               |
| created_by_user_id    | 24a8ae89a4fb4cb2aea945be1e0b2ede                               |
| display_name          | test1                                                          |
| ended_at              | None                                                           |
| flavor_id             | 1                                                              |
| host                  | 01ef05bbe0aaf8379bdfb4e0ed2108fb5b1d3ca6f3eece2792945134       |
| id                    | a6508f68-d8bf-4833-995a-4fc864297875                           |
| image_ref             | 75782a1b-6e9e-40ab-b382-e4954d5e4a1d                           |
| metrics               | cpu.delta: e2726019-a655-4b5b-bb16-c42b772f389b                |
|                       | cpu: 31ef7de7-3a6f-4b2c-bd81-384330489a5f                      |
|                       | cpu_util: 5345d4cd-2963-4975-830a-a450aae945d2                 |
|                       | disk.allocation: 37ca811d-c4dc-45b5-b7a1-42e8b6a28dc5          |
|                       | disk.capacity: 52b2b9f4-1831-4d53-95e1-25c6cd043042            |
|                       | disk.ephemeral.size: b721bea8-9e07-4666-9b56-0daccafd77e9      |
|                       | disk.iops: 946906b9-65d7-49ea-ab06-e9eed545ca7f                |
|                       | disk.latency: 5062e6d9-6b31-4687-b9a1-2bd6e05526e3             |
|                       | disk.read.bytes.rate: 0abe0a2f-2492-499e-ac1a-eaabb8a8d1ca     |
|                       | disk.read.bytes: ea6203a4-1435-4eaf-bf82-423a6972941d          |
|                       | disk.read.requests.rate: eac4eb5c-0815-4864-bec3-c6b0b3f21f99  |
|                       | disk.read.requests: 1eef9d15-c00e-4daf-a89e-065ae09df793       |
|                       | disk.root.size: 1ae17f1a-3f59-4112-8999-f2fe722bcb88           |
|                       | disk.usage: de8b1498-82f5-416d-a3af-6ba9a4d08e20               |
|                       | disk.write.bytes.rate: 69d3cf88-a889-4ac3-a155-8568c6827529    |
|                       | disk.write.bytes: e5da5cee-b697-4d98-b824-bbb205bd472f         |
|                       | disk.write.requests.rate: 4545640c-84f2-40a0-a45f-5ea36c981dd1 |
|                       | disk.write.requests: b3b2595e-95a4-45b3-bf25-8f271e123c90      |
|                       | instance: dcbf73e1-c69f-4885-87fb-90b2832c9f6a                 |
|                       | memory.resident: 988903a8-7cb0-44c6-bf13-b386ad1ce982          |
|                       | memory.usage: fddf1ff1-dc08-4b57-940d-8e45cf53a891             |
|                       | memory: 8b0c7d85-c5e5-409e-aa15-800ea4a99b31                   |
|                       | vcpus: a3e95aba-f1f1-4225-ba6a-386b4e6208f9                    |
| original_resource_id  | a6508f68-d8bf-4833-995a-4fc864297875                           |
| project_id            | dac563a2d45c408095b4a1a9774f0466                               |
| revision_end          | None                                                           |
| revision_start        | 2017-03-31T15:01:36.574039+00:00                               |
| server_group          | None                                                           |
| started_at            | 2017-03-31T14:19:36.956411+00:00                               |
| type                  | instance                                                       |
| user_id               | 3ec7a88fbc8f4cb4ae7a0f1ac0482296                               |
+-----------------------+----------------------------------------------------------------+


While trying to get the measures corresponding to the instance with metric id: 

~~~
[root@allinone10 ~(keystone_admin)]# gnocchi measures show 5345d4cd-2963-4975-830a-a450aae945d2 --resource-id a6508f68-d8bf-4833-995a-4fc864297875
Metric 5345d4cd-2963-4975-830a-a450aae945d2 does not exist (HTTP 404)
~~~

when using metric name, it's showing me all metrics which are registered in gnocchi which is not expected, as I am interested only in the value of particular instance. 

~~~
[root@allinone10 ~(keystone_admin)]# gnocchi measures show cpu_util --resource-id a6508f68-d8bf-4833-995a-4fc864297875
+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2017-03-31T14:00:00+00:00 |      3600.0 | 95.0034741784 |
| 2017-03-31T15:00:00+00:00 |      3600.0 | 97.6178670826 |
| 2017-03-31T14:20:00+00:00 |        60.0 |  98.028843595 |
| 2017-03-31T14:21:00+00:00 |        60.0 | 96.3927908786 |
| 2017-03-31T14:22:00+00:00 |        60.0 | 95.9071704623 |
| 2017-03-31T14:23:00+00:00 |        60.0 | 97.5791896593 |
| 2017-03-31T14:24:00+00:00 |        60.0 | 98.2158792355 |
| 2017-03-31T14:25:00+00:00 |        60.0 | 98.2143366319 |
| 2017-03-31T14:26:00+00:00 |        60.0 | 97.8779696206 |
| 2017-03-31T14:27:00+00:00 |        60.0 | 96.5648331207 |
| 2017-03-31T14:28:00+00:00 |        60.0 | 97.9022572884 |
| 2017-03-31T14:29:00+00:00 |        60.0 | 98.5206279772 |
~~~

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

[root@allinone10 ~(keystone_admin)]# rpm -qa | grep -i gnocc
openstack-gnocchi-api-3.0.4-2.el7ost.noarch
python-gnocchiclient-2.6.0-1.el7ost.noarch
openstack-gnocchi-common-3.0.4-2.el7ost.noarch
openstack-gnocchi-statsd-3.0.4-2.el7ost.noarch
openstack-gnocchi-metricd-3.0.4-2.el7ost.noarch
puppet-gnocchi-9.4.1-1.el7ost.noarch
openstack-gnocchi-carbonara-3.0.4-2.el7ost.noarch
python-gnocchi-3.0.4-2.el7ost.noarch
openstack-gnocchi-indexer-sqlalchemy-3.0.4-2.el7ost.noarch


How reproducible:
Everytime on test setup. 

Steps to Reproduce:
1. Spawn an instance, wait for gnocchi to register that instance. 
2. Try to fetch the measures for that instance by using metric id. It's throwing an error
3. Try to fetch the measure for that instance by using metric name, it's dumping all metrics which are registered for all instances. 

Actual results:
Not clear why metric id is not working.

Expected results:
It should give some meaningful error if nothing is present in gnocchi for particular metric id corresponding to instance resource. 

Additional info:

Comment 1 Mehdi ABAAKOUK 2017-04-10 15:24:10 UTC
You must not set the resource-id if you get the measures with the metric id, this is enough:

$ gnocchi measures show 5345d4cd-2963-4975-830a-a450aae945d2


When resource-id is set that means that the metric argument is a name and not an ID.

In your case metric ID "5345d4cd-2963-4975-830a-a450aae945d2" is the cpu.util of the instance a6508f68-d8bf-4833-995a-4fc864297875 

You need to choice between metric ID, or resource ID + metric name. Mixing them doesn't work.


Does that answer your question ?

Comment 2 VIKRANT 2017-04-10 16:16:13 UTC
Thank. Yes, it does answer my query.

I was mixing metric id + instance id which as per your comment is not a valid combination. 

Closing this bug.

Once again, thanks for your help.


Note You need to log in before you can comment on or make changes to this bug.