-
Notifications
You must be signed in to change notification settings - Fork 332
Metrics
Marc Chung edited this page Aug 4, 2016
·
9 revisions
There are some obvious but not so obvious questions you want to answer once you go production with a worker
- How long did it take to process a job
- How big are the messages
- How is the message handling looking? how many errors? rejects? accepts? requeues?
It's a pity to redo these every time again, and Sneakers will do it automatically for you in an opinionated (and polite) way
The metric variate will be a worker's class name.
- Counter: job start
- Counter: job end
- Counter: message handling and type (ack/reject/etc.)
- Timer: job length
- Timer: message size (to-be-implemented)
So for a worker called LogProcessor, in a StatsD provider, a metric would look like this:
prefix.work.LogProcessor.started.postfix
Given that prefix
and postfix
are yours to set at the statsd
level unrelated to Sneakers. I like to have [environment][product]
as prefix and [hostname]
as postfix.
-
NullMetrics
- good when you don't really want metrics, or are doing it custom on your own in the worker body -
StatsdMetrics
- production use with Statsd -
NewrelicMetrics
- production use with NewRelic, contributed by @arielze -
LoggingMetrics
- useful to see metrics as they happen as part of logging. -
Stackdriver
- (http://stackdriver.com) https://github.com/jondot/sneakers/issues/21
require 'sneakers/metrics/logging_metrics'
Sneakers.configure metrics: Sneakers::Metrics::LoggingMetrics.new,
other: 'configuration options'