Add logs in the SampleEndpoint class

While troubleshooting the issue reported on [1], we needed
to see the logs for the push workflow. However, there were
some processes that had no logs to help us identify the issue.

This patch is proposing a log addition, and a raise to an exception,
to facilitate future troubleshootings.

[1] https://review.opendev.org/c/openstack/ceilometer/+/901607

Change-Id: I36a195965712469e33e73de809f290edd42c8b51
This commit is contained in:
Rafael Weingärtner 2023-11-21 13:59:59 -03:00
parent 10ee6a9690
commit 12518e5e29
2 changed files with 12 additions and 3 deletions

View File

@ -132,7 +132,11 @@ class NotificationService(cotyledon.Service):
endpoints = []
for pipe_mgr in self.managers:
endpoints.extend(pipe_mgr.get_main_endpoints())
LOG.debug("Loading manager endpoints for [%s].", pipe_mgr)
endpoint = pipe_mgr.get_main_endpoints()
LOG.debug("Loaded endpoints [%s] for manager [%s].",
endpoint, pipe_mgr)
endpoints.extend(endpoint)
targets = self.get_targets()
urls = self.conf.notification.messaging_urls or [None]

View File

@ -38,10 +38,15 @@ class SampleEndpoint(base.NotificationEndpoint):
def process_notifications(self, priority, notifications):
for message in notifications:
try:
LOG.debug("Processing sample notification [%s] for publisher "
"[%s] with priority [%s] using the agent [%s].",
message, self.publisher, priority, self)
with self.publisher as p:
p(list(self.build_sample(message)))
except Exception:
LOG.error('Fail to process notification', exc_info=True)
except Exception as e:
LOG.error('Fail to process notification message [%s]'
% message, exc_info=True)
raise e
def build_sample(notification):
"""Build sample from provided notification."""