Partially-addresses: BP wider-aggregate-range
Support for two new aggregation functions has been added:
* stddev: population standard deviation (unparameterized)
* cardinality: count of distinct values for a sample attribute
(parameterized by attribute name)
For example in order to calculate the standard deviation of CPU util:
GET /v2/meters/cpu_util/statistics?aggregate.func=stddev
HTTP/1.0 200 OK
[{"aggregate": {"stddev": 0.6858829535841072},
"duration_start": "2014-01-30T11:13:23",
"duration_end": "2014-01-31T16:07:13",
"duration": 104030.0,
"period": 0,
"period_start": "2014-01-30T11:13:23",
"period_end": "2014-01-31T16:07:13",
"groupby": null,
"unit": "%"}]
Or to calculate the number of distinct instances that existed for
each tenant contrasted with the total number of instance samples
for that tenant in each 15 min period:
GET /v2/meters/instance/statistics?aggregate.func=cardinality&aggregate.param=resource_id
&aggregate.func=count
&groupby=project_id&period=900
HTTP/1.0 200 OK
[{"count": 19,
"aggregate": {"count": 19.0, "cardinality/resource_id": 3.0},
"duration": 328.478029,
"duration_start": "2014-01-31T10:00:41.823919",
"duration_end": "2014-01-31T10:06:10.301948",
"period": 900,
"period_start": "2014-01-31T10:00:00",
"period_end": "2014-01-31T10:15:00",
"groupby": {"project_id": "061a5c91811e4044b7dc86c6136c4f99"},
"unit": "instance"},
{"count": 22,
"aggregate": {"count": 22.0, "cardinality/resource_id": 4.0},
"duration": 808.00384,
"duration_start": "2014-01-31T10:15:15",
"duration_end": "2014-01-31T10:28:43.003840",
"period": 900,
"period_start": "2014-01-31T10:15:00",
"period_end": "2014-01-31T10:30:00",
"groupby": {"project_id": "061a5c91811e4044b7dc86c6136c4f99"},
"unit": "instance"},
{"count": 2,
"aggregate": {"count": 2.0, "cardinality/resource_id": 2.0},
"duration": 0.0,
"duration_start": "2014-01-31T10:35:15",
"duration_end": "2014-01-31T10:35:15",
"period": 900,
"period_start": "2014-01-31T10:30:00",
"period_end": "2014-01-31T10:45:00",
"groupby": {"project_id": "061a5c91811e4044b7dc86c6136c4f99"},
"unit": "instance"}]
Test coverage is provided by the scenario test added in
next patch of this series.
Change-Id: Id3a37622f35d9a7d757c485b4d486b3f01cc6474
5.9 KiB
5.9 KiB