Remove event_type field from meter messages

The event_type field is made up of the meter exchange name
and the counter name. That information is available elsewhere,
so the field is redundant.

bug 1006995

Change-Id: I37ed14e469bc146017ecceedd6539d61eb7823e1
This commit is contained in:
Doug Hellmann 2012-06-11 11:10:53 -04:00
parent f413db8a2a
commit 3b075dc7af
6 changed files with 7 additions and 13 deletions

View File

@ -82,11 +82,12 @@ class CollectorManager(manager.Manager):
"""
#LOG.info('metering data: %r', data)
LOG.info('metering data %s for %s: %s',
data['event_type'],
data['counter_name'],
data['resource_id'],
data['counter_volume'])
if not meter.verify_signature(data):
LOG.warning('message signature invalid, discarding message')
LOG.warning('message signature invalid, discarding message: %r',
data)
else:
try:
self.storage_conn.record_metering_data(data)

View File

@ -78,8 +78,6 @@ def meter_message_from_counter(counter):
'counter_duration': counter.duration,
'resource_metadata': counter.resource_metadata,
'message_id': str(uuid.uuid1()),
# This field is used by the notification system.
'event_type': '%s.%s' % (cfg.CONF.metering_topic, counter.type),
}
msg['message_signature'] = compute_signature(msg)
return msg

View File

@ -52,6 +52,6 @@ class Connection(base.Connection):
ceilometer.meter.meter_message_from_counter
"""
LOG.info('metering data %s for %s: %s',
data['event_type'],
data['counter_name'],
data['resource_id'],
data['counter_volume'])

View File

@ -36,7 +36,7 @@ class TestCollectorManager(test.TestCase):
self.ctx = context.RequestContext("user", "project")
def test_valid_message(self):
msg = {'event_type': 'test',
msg = {'counter_name': 'test',
'resource_id': self.id(),
'counter_volume': 1,
}
@ -50,7 +50,7 @@ class TestCollectorManager(test.TestCase):
self.mox.VerifyAll()
def test_invalid_message(self):
msg = {'event_type': 'test',
msg = {'counter_name': 'test',
'resource_id': self.id(),
'counter_volume': 1,
}

View File

@ -28,7 +28,7 @@ def test_get_connection():
conf.metering_storage_engine = 'log'
log_stg = impl_log.LogStorage()
conn = log_stg.get_connection(conf)
conn.record_metering_data({'event_type': 'test',
conn.record_metering_data({'counter_name': 'test',
'resource_id': __name__,
'counter_volume': 1,
})

View File

@ -134,11 +134,6 @@ def test_meter_message_from_counter_signed():
assert 'message_signature' in msg
def test_meter_message_from_counter_event_type():
msg = meter.meter_message_from_counter(TEST_COUNTER)
assert msg['event_type'] == 'metering.' + TEST_COUNTER.type
def test_meter_message_from_counter_field():
def compare(f, c, msg_f, msg):
assert msg == c