def _process_notifications(self, priority, notifications): for notification in notifications: try: notification = messaging.convert_to_old_notification_format( priority, notification) self.to_samples_and_publish(notification) except Exception: LOG.error(_LE('Fail to process notification'), exc_info=True)
def sample(self, ctxt, publisher_id, event_type, payload, metadata): """RPC endpoint for notification messages at sample level When another service sends a notification over the message bus at sample priority, this method receives it. :param ctxt: oslo.messaging context :param publisher_id: publisher of the notification :param event_type: type of notification :param payload: notification payload :param metadata: metadata about the notification """ notification = messaging.convert_to_old_notification_format( 'sample', ctxt, publisher_id, event_type, payload, metadata) self.to_samples_and_publish(context.get_admin_context(), notification)
def error(self, ctxt, publisher_id, event_type, payload, metadata): """Convert error message to Ceilometer Event. :param ctxt: oslo_messaging context :param publisher_id: publisher of the notification :param event_type: type of notification :param payload: notification payload :param metadata: metadata about the notification """ # NOTE: the rpc layer currently rips out the notification # delivery_info, which is critical to determining the # source of the notification. This will have to get added back later. notification = messaging.convert_to_old_notification_format( 'error', ctxt, publisher_id, event_type, payload, metadata) self.process_notification(notification)
def info(self, ctxt, publisher_id, event_type, payload, metadata): """RPC endpoint for notification messages When another service sends a notification over the message bus, this method receives it. :param ctxt: oslo.messaging context :param publisher_id: publisher of the notification :param event_type: type of notification :param payload: notification payload :param metadata: metadata about the notification """ notification = messaging.convert_to_old_notification_format( 'info', ctxt, publisher_id, event_type, payload, metadata) self.to_samples_and_publish(context.get_admin_context(), notification)
def _process_notifications(self, priority, notifications): """ This method will be called by self.info. :param priority: :param notifications: :return: """ for notification in notifications: try: notification = messaging.convert_to_old_notification_format( priority, notification) if self.hook_method: self.hook_method(notification) else: self.to_samples_and_publish(notification) except Exception: LOG.error(_LE('Fail to process notification'), exc_info=True)
def error(self, ctxt, publisher_id, event_type, payload, metadata): """Convert error message to Ceilometer Event. :param ctxt: oslo_messaging context :param publisher_id: publisher of the notification :param event_type: type of notification :param payload: notification payload :param metadata: metadata about the notification """ # NOTE: the rpc layer currently rips out the notification # delivery_info, which is critical to determining the # source of the notification. This will have to get added back later. notification = messaging.convert_to_old_notification_format( 'error', ctxt, publisher_id, event_type, payload, metadata) return self.process_notification(notification)
def process_notification(self, priority, notifications): for notification in notifications: # NOTE: the rpc layer currently rips out the notification # delivery_info, which is critical to determining the # source of the notification. This will have to get added back # later. notification = messaging.convert_to_old_notification_format(priority, notification) try: event = self.event_converter.to_event(notification) if event is not None: with self.manager.publisher() as p: p(event) except Exception: if not self.manager.conf.notification.ack_on_event_error: return oslo_messaging.NotificationResult.REQUEUE LOG.error(_LE("Fail to process a notification"), exc_info=True) return oslo_messaging.NotificationResult.HANDLED
def process_notification(self, priority, notifications): for notification in notifications: # NOTE: the rpc layer currently rips out the notification # delivery_info, which is critical to determining the # source of the notification. This will have to get added back # later. notification = messaging.convert_to_old_notification_format( priority, notification) try: event = self.event_converter.to_event(notification) if event is not None: with self.manager.publisher() as p: p(event) except Exception: if not self.manager.conf.notification.ack_on_event_error: return oslo_messaging.NotificationResult.REQUEUE LOG.error(_LE('Fail to process a notification'), exc_info=True) return oslo_messaging.NotificationResult.HANDLED