(self, queue_manager, queue_name, tags)
Grab stats from queues
Grab stats from queues
Grab stats from queues
def queue_stats(self, queue_manager, queue_name, tags):
        """
        Grab stats from queues
        """
        pcf = None
        try:
            args = {pymqi.CMQC.MQCA_Q_NAME: pymqi.ensure_bytes(queue_name), pymqi.CMQC.MQIA_Q_TYPE: pymqi.CMQC.MQQT_ALL}
            pcf = pymqi.PCFExecute(
                queue_manager, response_wait_interval=self.config.timeout, convert=self.config.convert_endianness
            )
            response = pcf.MQCMD_INQUIRE_Q(args)
        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 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.
            for queue_info in response:
                self._submit_queue_stats(queue_info, queue_name, tags)
        finally:
            if pcf is not None:
                pcf.disconnect()
def queue_stats ( self , queue_manager , queue_name , tags ) : pcf = None try : args = { pymqi . CMQC . MQCA_Q_NAME : pymqi . ensure_bytes ( queue_name ) , pymqi . CMQC . MQIA_Q_TYPE : pymqi . CMQC . MQQT_ALL } pcf = pymqi . PCFExecute ( queue_manager , response_wait_interval = self . config . timeout , convert = self . config . convert_endianness ) response = pcf . MQCMD_INQUIRE_Q ( args ) 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 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. for queue_info in response : self . _submit_queue_stats ( queue_info , queue_name , tags ) finally : if pcf is not None : pcf . disconnect ( )