'Do the stats calculation on a requested time bucket in stats dict
:param stats: dict where aggregated stats are kept
:param index: time bucket index in stats
:param meter: meter record as returned from HBase
:param start_time: query start time
:param period: length of the time bucket'

@staticmethod
def _update_meter_stats(stat, meter):

    vol = meter['counter_volume']
    ts = meter['timestamp']
    stat.unit = meter['counter_unit']
    stat.min = min(vol, (stat.min or vol))
    stat.max = max(vol, stat.max)
    stat.sum = (vol + (stat.sum or 0))
    stat.count += 1
    stat.avg = (stat.sum / float(stat.count))
    stat.duration_start = min(ts, (stat.duration_start or ts))
    stat.duration_end = max(ts, (stat.duration_end or ts))
    stat.duration = timeutils.delta_seconds(stat.duration_start, stat.duration_end)
