<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.openstack.org/w/index.php?action=history&amp;feed=atom&amp;title=User%3AGibi%2FHorizonInstanceStatistics</id>
		<title>User:Gibi/HorizonInstanceStatistics - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.openstack.org/w/index.php?action=history&amp;feed=atom&amp;title=User%3AGibi%2FHorizonInstanceStatistics"/>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=User:Gibi/HorizonInstanceStatistics&amp;action=history"/>
		<updated>2026-07-10T07:17:20Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=User:Gibi/HorizonInstanceStatistics&amp;diff=48940&amp;oldid=prev</id>
		<title>Gibi: Created page with &quot; = Horizon instance statistic query = [http://paste.openstack.org/show/54676/ pastebin] [http://people.redhat.com/~lsurette/OpenStack/Horizon%20Overview%20Pages_v1.0.pdf horiz...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=User:Gibi/HorizonInstanceStatistics&amp;diff=48940&amp;oldid=prev"/>
				<updated>2014-04-16T16:03:46Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot; = Horizon instance statistic query = [http://paste.openstack.org/show/54676/ pastebin] [http://people.redhat.com/~lsurette/OpenStack/Horizon%20Overview%20Pages_v1.0.pdf horiz...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
= Horizon instance statistic query =&lt;br /&gt;
[http://paste.openstack.org/show/54676/ pastebin]&lt;br /&gt;
[http://people.redhat.com/~lsurette/OpenStack/Horizon%20Overview%20Pages_v1.0.pdf horizon pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* fact1: &amp;quot;instance&amp;quot; meter reports 1 if the instance is _allocated_ regardless of the state of the instance. Except if the VM is in error state, in that case &amp;quot;instance&amp;quot; meter does not report sample.&lt;br /&gt;
* fact2: ceilometer does not have samples from the &amp;quot;instance&amp;quot; meter with counter_volume 0 for deleted instances obviously&lt;br /&gt;
* fact3: the state of the instance is not part of the metadata of the &amp;quot;instance&amp;quot; sample&lt;br /&gt;
&lt;br /&gt;
== Problem 1 ==&lt;br /&gt;
So first you want to calculate avg(counter_volume) grouped by resource_id then make a sum(counter_volume) grouped by project_id. &lt;br /&gt;
The avg(counter_volume) will produce invalid result for example if we have 6 measurement in an hour but the instance was running only half of the time, as we will have only 3 samples instead of 6 so the avg will be 1 instead of 1/2 due to fact2. If it is not a problem to get 1 instead of 1/2 for this case then you can use distinct instead of avg. The other possibility is to make the measurement period available on the API and just get sum(counter_volume) from the statistics API and then on the client side calculate the avg for the known period.&lt;br /&gt;
&lt;br /&gt;
== Problem 2 ==&lt;br /&gt;
Your query with two group bys cannot be expressed in one SELECT statement. We have to translate the first avg (or distinct) step to a subquery of the second step. Our original idea for complex query statistic will allow multiple group bys but we haven't planned to allow such group bys that needs subqueries.&lt;br /&gt;
&lt;br /&gt;
== Problem with DISTINCT ==&lt;br /&gt;
SELECT count(*), project_id FROM ( SELECT DISTINCT resource_id, project_id FROM Meter) GROUP BY project_id&lt;br /&gt;
&lt;br /&gt;
SELECT count(*), project_id FROM (SELECT avg(counter_volume), resource_id, project_id FROM Meter GROUP BY resource_id, project_id) GROUP BY project_id&lt;br /&gt;
&lt;br /&gt;
==&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT count(DISTINCT(resource_id, project_id)) FROM Meter GROUP BY project_id&lt;br /&gt;
* Only the count function is meaningful&lt;br /&gt;
* Only the instance meter can be aggregated this way&lt;br /&gt;
* Only the resource_id, project_id seems a valid DISTINCT parameter ???&lt;br /&gt;
&lt;br /&gt;
= TODO = &lt;br /&gt;
Gauge VM state counter  https://blueprints.launchpad.net/ceilometer/+spec/state-meter&lt;br /&gt;
Propose separate sub meter like instance:active, instance:stopped for clarity&lt;/div&gt;</summary>
		<author><name>Gibi</name></author>	</entry>

	</feed>