nytimes / collectd-rabbitmq

A collected plugin, written in python, to collect statistics from RabbitMQ.
https://collectd-rabbitmq.readthedocs.org/
Other
145 stars 79 forks source link

rabbit.get_queues() default value is invalid #68

Closed wrossmann closed 5 years ago

wrossmann commented 6 years ago

While working on my PR I ran into this bug where if I simply called rabbit.get_queues() it generated the following error:

Traceback (most recent call last):
  File "test.py", line 14, in <module>
    print len(rabbit.get_queues())
  File "/home/stack/src/rabbit.py", line 148, in get_queues
    return self.get_info("queues", vhost_name)
  File "/home/stack/src/rabbit.py", line 55, in get_info
    url = "{0}/{1}".format(self.api, '/'.join(args))
TypeError: sequence item 1: expected string, NoneType found

Which tracks back to vhost_name=None at collectd_rabbitmq/rabbit.py#L149, though I can't really determine what the default value should be since the test I was running technically shouldn't have been directly calling that function at all.