Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openstack exporter nova_server_status fails to return flavor id #220

Open
jheikki100 opened this issue Feb 3, 2022 · 5 comments
Open

openstack exporter nova_server_status fails to return flavor id #220

jheikki100 opened this issue Feb 3, 2022 · 5 comments

Comments

@jheikki100
Copy link

We are trying to get openstack metrics to Prometheus for further accounting data processing with cloudkitty.
However, when I query prometheus metrics from openstack exporter

openstack_nova_server_status field flavor_id is always returning <nil> in prometheus openstack exporter.

For example:

openstack_nova_server_status{address_ipv4="",address_ipv6="",availability_zone="nova",flavor_id="<nil>",host_id="34473036769974153a388fb747e773fd7aa6095e48c6e23096b105c1",h
ypervisor_hostname="bm-compute01-lm",id="4177d13c-d42b-499c-a917-c76d2dc75226",name="demo-jhtest",status="ACTIVE",tenant_id="960168fa6ffd4b1d8d6007c3f234fa6c",user_id="d4fe
783e96a743fdba7d207b519802c7",uuid="4177d13c-d42b-499c-a917-c76d2dc75226"} 0

It seems that Prometheus is aware of flavors because direct query
curl 'http:https://prometheus_host:9091/api/v1/label/flavor_id/values
returns list where values correspond to existing flavor ids in OpenStack.

Our OpenStack instance is currently on Wallaby release and is based on Kolla-Ansible.

Looking forward for suggestions or a fix because we really need the flavor_id in downstream accounting processing.

@engel75
Copy link

engel75 commented May 10, 2022

Same problem with rocky. Output of v1.1.0 vs v1.5.0:

v1.1.0
openstack_nova_server_status{address_ipv4="",address_ipv6="",availability_zone="ch-zh1-az2",flavor_id="xxxxx-4a78-8dc0-206deexxxxxxxx",host_id="c3165b602471b79356d6210a2775b0f6c9b268065292aff84a2615d8",id="xxxxxxxx",name="test-u1804-az2",status="ACTIVE",tenant_id="yyyyyyyyyyyyyyy",user_id="zzzzzzzzzzzz",uuid="idididididid"} 0

v1.5.0
openstack_nova_server_status{address_ipv4="",address_ipv6="",availability_zone="ch-zh1-az2",flavor_id="<nil>",host_id="c3165b602471b79356d6210a2775b0f6c9b268065292aff84a2615d8",hypervisor_hostname="xxxxxxxxxx",id="bee90dce-6256-4b64-82be-380fb6b5557f",name="test-u1804-az2",status="ACTIVE",tenant_id="yyyyyyyyy",user_id="zzzzz",uuid="idididididid"} 0

@gtherond
Copy link

That's because the way the flavor are returned by the API changed with a microversion and that microversion was promoted as the minimum version for victoria.

Horizon had the same issue up to 18.6.4 that was recently patched: https://bugs.launchpad.net/horizon/+bug/1940834

priteau added a commit to stackhpc/kolla-ansible that referenced this issue Jun 16, 2022
Nova API version 2.88 removed details from the os-hypervisors API [1].
These details are queried by openstack-exporter for metrics such as
openstack_nova_running_vms. However, a change between v1.3.0 and v1.4.0
of the exporter caused it to use the latest API version, breaking
collection of these metrics [2].

Starting from v1.5.0 of the exporter, OS_COMPUTE_API_VERSION can be set
to configure the Nova API version to be used. Set it to 2.79 (maximum in
Train), which also fixes an issue displaying the flavor ID [4].

[1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-wallaby
[2] openstack-exporter/openstack-exporter#191
[3] openstack-exporter/openstack-exporter#201
[4] openstack-exporter/openstack-exporter#220

Change-Id: I7605a3f9f74effb29ecec3b28e4709fd5f7f8cd4
priteau added a commit to stackhpc/kolla-ansible that referenced this issue Jun 16, 2022
Nova API version 2.88 removed details from the os-hypervisors API [1].
These details are queried by openstack-exporter for metrics such as
openstack_nova_running_vms. However, a change between v1.3.0 and v1.4.0
of the exporter caused it to use the latest API version, breaking
collection of these metrics [2].

Starting from v1.5.0 of the exporter, OS_COMPUTE_API_VERSION can be set
to configure the Nova API version to be used. Set it to 2.79 (maximum in
Train), which also fixes an issue displaying the flavor ID [4].

[1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-wallaby
[2] openstack-exporter/openstack-exporter#191
[3] openstack-exporter/openstack-exporter#201
[4] openstack-exporter/openstack-exporter#220

Change-Id: I7605a3f9f74effb29ecec3b28e4709fd5f7f8cd4
@priteau
Copy link
Contributor

priteau commented Jun 16, 2022

I believe this changed with microversion 2.47: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id43

Replace the flavor name/ref with the actual flavor details from the embedded flavor object when displaying server details. Requests made with microversion >= 2.47 will no longer return the flavor ID/link but instead will return a subset of the flavor details. If the user is prevented by policy from indexing extra-specs, then the extra_specs field will not be included in the flavor information.

@priteau
Copy link
Contributor

priteau commented Jun 16, 2022

Same problem with rocky. Output of v1.1.0 vs v1.5.0:

v1.1.0
openstack_nova_server_status{address_ipv4="",address_ipv6="",availability_zone="ch-zh1-az2",flavor_id="xxxxx-4a78-8dc0-206deexxxxxxxx",host_id="c3165b602471b79356d6210a2775b0f6c9b268065292aff84a2615d8",id="xxxxxxxx",name="test-u1804-az2",status="ACTIVE",tenant_id="yyyyyyyyyyyyyyy",user_id="zzzzzzzzzzzz",uuid="idididididid"} 0

v1.5.0
openstack_nova_server_status{address_ipv4="",address_ipv6="",availability_zone="ch-zh1-az2",flavor_id="<nil>",host_id="c3165b602471b79356d6210a2775b0f6c9b268065292aff84a2615d8",hypervisor_hostname="xxxxxxxxxx",id="bee90dce-6256-4b64-82be-380fb6b5557f",name="test-u1804-az2",status="ACTIVE",tenant_id="yyyyyyyyy",user_id="zzzzz",uuid="idididididid"} 0

Since v1.4.0, openstack-exporter will use the latest Nova API microversion, which means any OpenStack cloud running Pike or newer will see this behaviour.

You can use the OS_COMPUTE_API_VERSION environment variable to configure the Nova API microversion to use. Set it to version 2.46 or any other below and flavor_id will be included as before.

@gtherond
Copy link

But still, this doesn't fix the fact that exporter don't catch up latest available information/data from the new API microversion.
Shouldn't the exporter rather fix min/max microversion it support itself for each release rather?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants