Module: Resque::Plugins::Analytics
- Defined in:
- lib/resque-analytics/server.rb,
lib/resque/plugins/analytics.rb
Defined Under Namespace
Modules: Server
Constant Summary collapse
- FAILED =
"failed"- PERFORMED =
"performed"- TOTAL_TIME =
"total_time"- WAIT_TIME =
"wait_time"- EXPIRE =
90 * 24 * 60
Class Method Summary collapse
Instance Method Summary collapse
- #after_perform_analytics(*args) ⇒ Object
- #analytics_timestamp(timestamp) ⇒ Object
- #around_perform_analytics(*args) ⇒ Object
- #key(kpi) ⇒ Object
- #on_failure_analytics(error, *args) ⇒ Object
Class Method Details
.ignore_classes ⇒ Object
38 39 40 |
# File 'lib/resque/plugins/analytics.rb', line 38 def self.ignore_classes @ignore_classes || [] end |
.ignore_classes=(class_array) ⇒ Object
34 35 36 |
# File 'lib/resque/plugins/analytics.rb', line 34 def self.ignore_classes=(class_array) @ignore_classes = class_array end |
Instance Method Details
#after_perform_analytics(*args) ⇒ Object
56 57 58 59 |
# File 'lib/resque/plugins/analytics.rb', line 56 def after_perform_analytics(*args) Resque.redis.incr(key(PERFORMED)) Resque.redis.expire(key(WAIT_TIME), EXPIRE) end |
#analytics_timestamp(timestamp) ⇒ Object
66 67 68 69 |
# File 'lib/resque/plugins/analytics.rb', line 66 def () Resque.redis.lpush(key(WAIT_TIME), Time.now - Time.parse()) Resque.redis.expire(key(WAIT_TIME), EXPIRE) end |
#around_perform_analytics(*args) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/resque/plugins/analytics.rb', line 47 def around_perform_analytics(*args) start = Time.now yield total_time = Time.now - start Resque.redis.lpush(key(TOTAL_TIME), total_time) Resque.redis.expire(key(WAIT_TIME), EXPIRE) end |
#key(kpi) ⇒ Object
42 43 44 45 |
# File 'lib/resque/plugins/analytics.rb', line 42 def key(kpi) date = Time.now.strftime("%y_%m_%d") "analytics:#{kpi}:#{self.name}:#{date}" end |