At the moment we use the package boto
to get queue messages and then, do some processing. The relevant code is:
from boto.sqs.message import RawMessage
import boto.sqs
import boto.sns
import json
conn = boto.sqs.connect_to_region(
"us-west-1",
aws_access_key_id="XXXXXXX",
aws_secret_access_key="XXXXXXX")
q=conn.get_queue('queueName')
q.set_message_class(RawMessage)
res=q.get_messages(10,wait_time_seconds=1)
....
and the rest is just processing code (not important for the question). This code works perfectly.
I was wondering if there is a way to, from python, get the metrics of the queue, for example, NumberOfMessagesSent
.
Based on this post get metrics and the CloudWatch website, I thought there might be something like
conn = boto.sqs.cloudwatch.connect_to_region()
from which I could do
conn.get_metric_statistics()
but it does not seem to be the case (unless I have missed something).
I have found this very nice piece of code. But I was wondering if there is something "better" (or a more concise alternative) within boto.sqs