Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug line when there are no messages available #9702

Merged
merged 2 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def get_pcf_channel_metrics(self, queue_manager):
except pymqi.MQMIError as e:
# Don't warn if no messages, see:
# https://github.com/dsuch/pymqi/blob/v1.12.0/docs/examples.rst#how-to-wait-for-multiple-messages
if not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("There are no messages available for PCF channel")
else:
self.log.warning("Error getting CHANNEL stats %s", e)
else:
channels = len(response)
Expand Down Expand Up @@ -94,7 +96,9 @@ def _submit_channel_status(self, queue_manager, search_channel_name, tags, chann
self.service_check(self.CHANNEL_SERVICE_CHECK, AgentCheck.CRITICAL, search_channel_tags)
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQCFC.MQRCCF_CHL_STATUS_NOT_FOUND:
self.log.debug("Channel status not found for channel %s: %s", search_channel_name, e)
elif not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
elif e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("There are no messages available for channel %s", search_channel_name)
else:
self.log.warning("Error getting CHANNEL status for channel %s: %s", search_channel_name, e)
else:
for channel_info in response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def _discover_queues(self, queue_manager, mq_pattern_filter):
except pymqi.MQMIError as e:
# Don't warn if no messages, see:
# https://github.com/dsuch/pymqi/blob/v1.12.0/docs/examples.rst#how-to-wait-for-multiple-messages
if not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("No queue info available")
else:
self.warning("Error discovering queue: %s", e)
else:
for queue_info in response:
Expand Down Expand Up @@ -130,7 +132,9 @@ def queue_stats(self, queue_manager, queue_name, tags):
except pymqi.MQMIError as e:
# Don't warn if no messages, see:
# https://github.com/dsuch/pymqi/blob/v1.12.0/docs/examples.rst#how-to-wait-for-multiple-messages
if not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("No stat messages available for queue %s", queue_name)
else:
self.warning("Error getting queue stats for %s: %s", queue_name, e)
else:
# Response is a list. It likely has only one member in it.
Expand Down Expand Up @@ -169,8 +173,10 @@ def get_pcf_queue_status_metrics(self, queue_manager, queue_name, tags):
except pymqi.MQMIError as e:
# Don't warn if no messages, see:
# https://github.com/dsuch/pymqi/blob/v1.12.0/docs/examples.rst#how-to-wait-for-multiple-messages
if not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
self.warning("Error getting pcf queue stats for %s: %s", queue_name, e)
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("No PCF queue status messages available for queue %s", queue_name)
else:
self.warning("Error getting pcf queue status for %s: %s", queue_name, e)
else:
# Response is a list. It likely has only one member in it.
for queue_info in response:
Expand Down Expand Up @@ -199,8 +205,10 @@ def get_pcf_queue_reset_metrics(self, queue_manager, queue_name, tags):
except pymqi.MQMIError as e:
# Don't warn if no messages, see:
# https://github.com/dsuch/pymqi/blob/v1.12.0/docs/examples.rst#how-to-wait-for-multiple-messages
if not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
self.warning("Error getting pcf queue stats for %s: %s", queue_name, e)
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("No PCF queue reset metrics messages available for queue %s", queue_name)
else:
self.warning("Error getting pcf queue reset metrics for %s: %s", queue_name, e)
else:
# Response is a list. It likely has only one member in it.
for queue_info in response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def collect(self, queue_manager):
except pymqi.MQMIError as e:
# Don't warn if no messages, see:
# https://github.com/dsuch/pymqi/blob/v1.12.0/docs/examples.rst#how-to-wait-for-multiple-messages
if not (e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE):
if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
self.log.debug("No messages available")
else:
raise
finally:
queue.close()
Expand Down