'Return an iterable of api_models.Statistics instances.
Items are containing meter statistics described by the query
parameters. The filter must have a meter value set.'

def get_meter_statistics(self, sample_filter, period=None, groupby=None, aggregate=None):

    if groupby:
        for group in groupby:
            if (group not in ['user_id', 'project_id', 'resource_id', 'resource_metadata.instance_type']):
                raise ceilometer.NotImplementedError('Unable    to    group    by    these    fields')
    if (not period):
        for res in self._make_stats_query(sample_filter, groupby, aggregate):
            if res.count:
                (yield self._stats_result_to_model(res, 0, res.tsmin, res.tsmax, groupby, aggregate))
        return
    if (not (sample_filter.start_timestamp and sample_filter.end_timestamp)):
        res = self._make_stats_query(sample_filter, None, aggregate).first()
        if (not res):
            return
    query = self._make_stats_query(sample_filter, groupby, aggregate)
    for (period_start, period_end) in base.iter_period((sample_filter.start_timestamp or res.tsmin), (sample_filter.end_timestamp or res.tsmax), period):
        q = query.filter((models.Sample.timestamp >= period_start))
        q = q.filter((models.Sample.timestamp < period_end))
        for r in q.all():
            if r.count:
                (yield self._stats_result_to_model(result=r, period=int(timeutils.delta_seconds(period_start, period_end)), period_start=period_start, period_end=period_end, groupby=groupby, aggregate=aggregate))
