OvalMoney / celery-exporter

Prometheus metrics exporter for Celery
MIT License
142 stars 37 forks source link

SQS broker support? #26

Closed utkarshyadavin closed 3 years ago

utkarshyadavin commented 4 years ago

Does the given library if of any use if SQS is configured to be used as broker for celery?

ghost commented 3 years ago

There does not appear to be support for SQS, an attempt to connect results in a PurgeQueueInProgress exception.

[2020-12-15 17:49:23,464] root:INFO: Starting HTTPD on 0.0.0.0:9540
[2020-12-15 17:49:34,056] task-thread:INFO: Start capturing events...
[2020-12-15 17:49:34,189] kombu.mixins:INFO: Connected to sqs://<snip>:**@localhost//
[2020-12-15 17:49:48,895] workers-thread:ERROR: Error while pinging workers
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/celery_exporter/monitor.py", line 86, in update_workers_count
    len(self._app.control.ping(timeout=self.celery_ping_timeout_seconds))
  File "/usr/local/lib/python3.6/site-packages/celery/app/control.py", line 263, in ping
    timeout=timeout, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/celery/app/control.py", line 476, in broadcast
    limit, callback, channel=channel,
  File "/usr/local/lib/python3.6/site-packages/kombu/pidbox.py", line 350, in _broadcast
    channel=chan)
  File "/usr/local/lib/python3.6/site-packages/kombu/pidbox.py", line 394, in _collect
    chan.after_reply_message_received(queue.name)
  File "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 543, in after_reply_message_received
    self.queue_delete(queue)
  File "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 539, in queue_delete
    self._delete(queue, exchange, *meta, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/kombu/transport/SQS.py", line 266, in _delete
    super()._delete(queue)
  File "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 378, in _delete
    self._purge(queue)
  File "/usr/local/lib/python3.6/site-packages/kombu/transport/SQS.py", line 510, in _purge
    self.sqs(queue=queue).purge_queue(QueueUrl=q)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 676, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.PurgeQueueInProgress: An error occurred (AWS.SimpleQueueService.PurgeQueueInProgress) when calling the PurgeQueue operation: Only one PurgeQueue operation on 0ce835bc-a6b3-3276-9c27-bcc9b006f93b-reply-celery-pidbox is allowed every 60 seconds.

This is based on the :latest image with boto3 library added.

maguayo commented 3 years ago

Did you solve it?

SharpEdgeMarshall commented 3 years ago

SQS monitoring is not supported by Celery https://docs.celeryproject.org/en/master/getting-started/backends-and-brokers/index.html#broker-overview