summaryrefslogtreecommitdiff
path: root/ceilometer/event
diff options
context:
space:
mode:
authorgord chung <gord@live.ca>2017-06-22 19:13:46 +0000
committergord chung <gord@live.ca>2017-06-22 19:13:46 +0000
commitc3427cbb4833e7719846cc76f8443784826a8e51 (patch)
treed4955a4564817da67688bef8f7d88478092e70e3 /ceilometer/event
parentfa512ce795f6169b92572c54d82acb8a9d755464 (diff)
downloadceilometer-c3427cbb4833e7719846cc76f8443784826a8e51.tar.gz
expect oslo.messaging messages
all our code assumes we're using oslo.messaging message wrapper which has a timestamp, event_type, priority, payload. there exists code in event generation that allows for timestamp to be missing but this is impossible unless someone recreated the oslo.messaging format and for some reason just wanted to see the world burn and left out the timestamp. let's just only handle 100% oslo.messaging. Change-Id: I530e7947e9d71370c14f1484724630b2a8edc059
Diffstat (limited to 'ceilometer/event')
-rw-r--r--ceilometer/event/converter.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/ceilometer/event/converter.py b/ceilometer/event/converter.py
index 4190e4ed..72bdae9e 100644
--- a/ceilometer/event/converter.py
+++ b/ceilometer/event/converter.py
@@ -140,25 +140,11 @@ class EventDefinition(object):
def is_catchall(self):
return '*' in self._included_types and not self._excluded_types
- @staticmethod
- def _extract_when(body):
- """Extract the generated datetime from the notification."""
- # NOTE: I am keeping the logic the same as it was in the collector,
- # However, *ALL* notifications should have a 'timestamp' field, it's
- # part of the notification envelope spec. If this was put here because
- # some openstack project is generating notifications without a
- # timestamp, then that needs to be filed as a bug with the offending
- # project (mdragon)
- when = body.get('timestamp', body.get('_context_timestamp'))
- if when:
- return timeutils.normalize_time(timeutils.parse_isotime(when))
-
- return timeutils.utcnow()
-
def to_event(self, notification_body):
event_type = notification_body['event_type']
message_id = notification_body['message_id']
- when = self._extract_when(notification_body)
+ when = timeutils.normalize_time(timeutils.parse_isotime(
+ notification_body['timestamp']))
traits = (self.traits[t].to_trait(notification_body)
for t in self.traits)