Merge "improve statistic_aggregation"
This commit is contained in:
@@ -134,19 +134,16 @@ class CeilometerHelper(object):
|
|||||||
aggregate='avg'):
|
aggregate='avg'):
|
||||||
"""Representing a statistic aggregate by operators
|
"""Representing a statistic aggregate by operators
|
||||||
|
|
||||||
:param resource_id: id
|
:param resource_id: id of resource to list statistics for.
|
||||||
:param meter_name: meter names of which we want the statistics
|
:param meter_name: Name of meter to list statistics for.
|
||||||
:param period: `period`: In seconds. If no period is given, only one
|
:param period: Period in seconds over which to group samples.
|
||||||
aggregate statistic is returned. If given, a faceted
|
:param aggregate: Available aggregates are: count, cardinality,
|
||||||
result will be returned, divided into given periods.
|
min, max, sum, stddev, avg. Defaults to avg.
|
||||||
Periods with no data are ignored.
|
:return: Return the latest statistical data, None if no data.
|
||||||
:param aggregate:
|
|
||||||
:return:
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
end_time = datetime.datetime.utcnow()
|
end_time = datetime.datetime.utcnow()
|
||||||
start_time = (datetime.datetime.utcnow() -
|
start_time = end_time - datetime.timedelta(seconds=int(period))
|
||||||
datetime.timedelta(seconds=int(period)))
|
|
||||||
query = self.build_query(
|
query = self.build_query(
|
||||||
resource_id=resource_id, start_time=start_time, end_time=end_time)
|
resource_id=resource_id, start_time=start_time, end_time=end_time)
|
||||||
statistic = self.query_retry(f=self.ceilometer.statistics.list,
|
statistic = self.query_retry(f=self.ceilometer.statistics.list,
|
||||||
|
|||||||
Reference in New Issue
Block a user