SnowAgent
Gem for sending metrics to SnowmanIO.
Installation
- Register new application in your SnowmanIO instance.
- Add
gem 'snowagent'
to application's Gemfile. - Add two environments variables as described on 'Install' section of application
Example of installation instructions page:
Usage
The main goal of SnowmanIO is to collect low frequient business metrics and trends. So the agent supports only synchronous mode of sending metrics via HTTP/HTTPS.
It's strongly recomended don't send metric directly from request. Instead use cron tasks, delalyed jobs and other background processes to deliver metrics!
Code examples:
# In controller
SnowAgent.delay.increment("User Login")
SnowAgent.delay.increment("User Login", 1, user_id: user.id)
# In scheduled task
SnowAgent.time("Task Time") do
# time consumed calculations
end
# Custom metric
SnowAgent.amount("Sessions Amount", Session.alive.count)
Testing
SNOWMANIO_SERVER=<server> SNOWMANIO_SECRET_TOKEN=<token> bundle exec ruby -e \
'require "snowagent"; SnowAgent.increment("User Login", 1, user_id: 123)'
Contributing
- Implement a feature (remember about tests and CHANGELOG.md!)
- (optional) Suggest a blog mini post about new feature
- :snowman: will be happier