lib/alephant/publisher/queue/sqs_helper/queue.rb in alephant-publisher-queue-1.3.3 vs lib/alephant/publisher/queue/sqs_helper/queue.rb in alephant-publisher-queue-1.3.4
- old
+ new
@@ -27,26 +27,41 @@
end
private
def process(m)
- logger.metric(:name => "PublisherQueueSQSHelperMessagesReceived", :unit => "Count", :value => 1)
+ logger.metric(
+ "MessagesReceived",
+ opts[:dimensions].merge(:function => "process")
+ )
logger.info("Queue#message: received #{m.id}")
archive m
end
def archive(m)
archiver.see(m) unless archiver.nil?
rescue StandardError => e
- logger.metric(:name => "PublisherQueueSQSHelperArchiveFailed", :unit => "Count", :value => 1)
+ logger.metric(
+ "ArchiveFailed",
+ opts[:dimensions].merge(:function => "archive")
+ )
logger.warn("Queue#archive: archive failed (#{e.message})");
end
def receive
queue.receive_message({
:visibility_timeout => timeout,
:wait_time_seconds => wait_time
})
+ end
+
+ def opts
+ {
+ :dimensions => {
+ :module => "PublisherQueueSQSHelper",
+ :class => "Queue"
+ }
+ }
end
end
end
end
end