charting of meters for all resource types other than instance is broken when not grouped by project

Bug #1243796 reported by Eoghan Glynn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Ladislav Smola
Havana
Fix Released
High
Julie Pichon

Bug Description

The 'Group by' dropdown on the Stats tab of the admin/Resource Usage panel allows the statistics to be grouped by either Project or '--'.

From the code, it seems the intent of the '--' option is to group by resource ID, as opposed to project ID.

This works as expected for the Compute (Nova) meters, but is broken for all the meters associated with any other resource type (glance images, swift objects, etc.)

This is because the strategy used to query statistics by resource is to first find all the resources of the relevant type, then iterate over the resources separately querying for the statistics associated with the meter in question for each individual resource.

The problem is that this initial query to discover the relevant resources is hard-coded in the group-by resource case to only ever identify instances:

  https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/admin/metering/views.py#L124

As a result, the panel attempts to retrieve statistics for non-instance meters (e.g. 'image.download' or 'storage.objects') constrained to a resource ID associated with an instance. All of those queries are guaranteed never to yield any data.

Instead, this iterative strategy should be replaced with a *single* statistics query with the 'groupby=resource_id' param set.

Tags: metering-ui
Eoghan Glynn (eglynn)
tags: added: metering-ui
Revision history for this message
Ladislav Smola (lsmola) wrote :

Oh, the query shouldn't be there. Darn I have been probably testing that on Nova instances and I forgot to make it general.

It should filter the resources according to meter name. (That is the only way I found for resource filtering.)

Will fix this

Changed in horizon:
assignee: nobody → Ladislav Smola (lsmola)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/53409

Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
Ladislav Smola (lsmola) wrote :

Please check it out whether it's alright now. Don't know how I could miss that, I guess non-compute resources wasn't that important to me. :-)

It would be enough to just delete the query. But the filtering is there so it sends statistics query only for resources, that has currently selected meter.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/53409
Committed: http://github.com/openstack/horizon/commit/1e1da618bb75783e1d8316894705c01f7bb9153b
Submitter: Jenkins
Branch: master

commit 1e1da618bb75783e1d8316894705c01f7bb9153b
Author: Ladislav Smola <email address hidden>
Date: Wed Oct 23 19:40:59 2013 +0200

    Broken charting for non compute resources

    - Code for resource charts contained query that
      filtered only nova instances. That condition
      is removed. Now it filters resources by the
      meter name.

    Fixes bug 1243796

    Change-Id: I7debb2b457ede83b726934c082f22307ddc0c630

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
Łukasz Jernaś (deejay1) wrote :

I'd like the change to be backported to stable/havana. Should I propose the fix in gerrit or just tag this bug as havana-backport-potential ?

Revision history for this message
Ladislav Smola (lsmola) wrote :

Not sure, please ask some core on irc.

Revision history for this message
Julie Pichon (jpichon) wrote :

In general adding the havana-backport-potential tag is enough to bring it to the attention of the people interested in stable releases. If you want to propose the backport fix yourself as well, you're welcome to :)

Looking at the patch it looks appropriate for a backport, I'll open the Launchpad task.

Changed in horizon:
importance: Undecided → High
Eoghan Glynn (eglynn)
tags: added: havana-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/55425

tags: removed: havana-backport-potential
Kieran Spear (kspear)
Changed in horizon:
milestone: none → icehouse-1
tags: added: havana-backport-potential
Akihiro Motoki (amotoki)
tags: removed: havana-backport-potential
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Revision history for this message
Alan Pevec (apevec) wrote :

Havana backport seems to be superceeded by (now merged) bug 1249279 ?

Revision history for this message
Ladislav Smola (lsmola) wrote :

No, the bug 1249279 is deleting 4 tabs with table statistic. This bug is fixing the fifth tab with the chart showing all the stats. The chart is staying.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/havana)

Reviewed: https://review.openstack.org/55425
Committed: http://github.com/openstack/horizon/commit/1912cc6a88dca7238da7c444a1ede84b983ab354
Submitter: Jenkins
Branch: stable/havana

commit 1912cc6a88dca7238da7c444a1ede84b983ab354
Author: Julie Pichon <email address hidden>
Date: Thu Dec 5 19:10:45 2013 +0000

    Broken charting for non compute resources

    - Code for resource charts contained query that
      filtered only nova instances. That condition
      is removed. Now it filters resources by the
      meter name.

    Fixes bug 1243796

    Conflicts:
     openstack_dashboard/dashboards/admin/metering/tests.py

    Change-Id: I7debb2b457ede83b726934c082f22307ddc0c630
    (cherry picked from commit 1e1da618bb75783e1d8316894705c01f7bb9153b)

Thierry Carrez (ttx)
Changed in horizon:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.