Try to get rid of the "events" & "raw events" naming in the code.

Rather use the term "samples" as having both is confusing.
Note: this does *not* change the API, just the terminology in the code.

bug 1104492
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Change-Id: If8cf89db60b52815db8e0acbf466400d0e9238c6
This commit is contained in:
Angus Salkeld
2013-03-20 22:12:59 +11:00
parent 4abb407152
commit a7000fd1ca
10 changed files with 107 additions and 103 deletions

View File

@@ -116,7 +116,7 @@ def make_query_from_filter(event_filter, require_meter=True):
if event_filter.source:
q['source'] = event_filter.source
# so the events call metadata resource_metadata, so we convert
# so the samples call metadata resource_metadata, so we convert
# to that.
q.update(dict(('resource_%s' % k, v)
for (k, v) in event_filter.metaquery.iteritems()))
@@ -409,7 +409,7 @@ class Connection(base.Connection):
# to put into it today.
if start_timestamp or end_timestamp:
# Look for resources matching the above criteria and with
# events in the time range we care about, then change the
# samples in the time range we care about, then change the
# resource query to return just those resources by id.
ts_range = make_timestamp_range(start_timestamp, end_timestamp)
if ts_range:
@@ -469,18 +469,18 @@ class Connection(base.Connection):
m['user_id'] = r['user_id']
yield m
def get_raw_events(self, event_filter):
"""Return an iterable of raw event data as created by
def get_samples(self, event_filter):
"""Return an iterable of samples as created by
:func:`ceilometer.meter.meter_message_from_counter`.
"""
q = make_query_from_filter(event_filter, require_meter=False)
events = self.db.meter.find(q)
for e in events:
samples = self.db.meter.find(q)
for s in samples:
# Remove the ObjectId generated by the database when
# the event was inserted. It is an implementation
# detail that should not leak outside of the driver.
del e['_id']
yield e
del s['_id']
yield s
def get_meter_statistics(self, event_filter, period=None):
"""Return a dictionary containing meter statistics.
@@ -524,7 +524,7 @@ class Connection(base.Connection):
key=operator.itemgetter('period_start'))
def get_volume_sum(self, event_filter):
"""Return the sum of the volume field for the events
"""Return the sum of the volume field for the samples
described by the query parameters.
"""
q = make_query_from_filter(event_filter)
@@ -537,7 +537,7 @@ class Connection(base.Connection):
for r in results['results'])
def get_volume_max(self, event_filter):
"""Return the maximum of the volume field for the events
"""Return the maximum of the volume field for the samples
described by the query parameters.
"""
q = make_query_from_filter(event_filter)
@@ -578,8 +578,8 @@ class Connection(base.Connection):
return (a_min, a_max)
def get_event_interval(self, event_filter):
"""Return the min and max timestamps from events,
using the event_filter to limit the events seen.
"""Return the min and max timestamps from samples,
using the event_filter to limit the samples seen.
( datetime.datetime(), datetime.datetime() )
"""