Skip to content

Instantly share code, notes, and snippets.

@phstc
Created July 25, 2013 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstc/6079750 to your computer and use it in GitHub Desktop.
Save phstc/6079750 to your computer and use it in GitHub Desktop.
# lib/augury/queues/incoming.rb
def self.push(messages)
messages = normalize_and_validate(messages)
messages.each do |msg|
# insert message into mongo collection
collection.insert(msg.inspect)
# I will encapsulate this code. It is just a test.
store = Augury.collections.stores.find({ "_id" => msg["store_id"] })
msg_key = msg['key'].gsub(':', '_')
# [customer].[server].[source].[msg].incoming
Augury.statsd.increment "#{store['permalink']}.#{Augury.server_name}.#{msg['source']}.#{msg_key}.incoming"
end
Augury.statsd.count "queues.incoming", messages.count
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment