resque-analytics 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8de6baa0566eba06c36469565d9009916a5cf90e
4
- data.tar.gz: 7663f90c6cc5e2d077d4ffca27df142bf38e19fc
3
+ metadata.gz: e009321250d82eaca1eddd22e9d9ffd4fcca1652
4
+ data.tar.gz: ec141d2a85a1e9fb3208bf1bff59f0b42429dce9
5
5
  SHA512:
6
- metadata.gz: 3c432ae57588fc5702e2aab0a90e5de810a0614787e02c874a4b5fc02a1991a1337941f764804997c9670085bce3175736257fdae6fb2b0bbb8ee9a7e1b80a83
7
- data.tar.gz: dd1bd16df30452dfdb7a16a19dfe5db7469c340d36e20580bf12db8a96c4dccf075b9ee83fd0d443975bbe95ffae20fbfddb3ce0c26167fdb3c8b2e388f59067
6
+ metadata.gz: 23504a44a8604a81611391abc5bc27a6b876cc8b353b8cf22fead4cf98ef8c4fe19ecd886d302a1e47cdb7d4259aa44bd347e06ea1201808464a74fadb808846
7
+ data.tar.gz: 1911eb9a179f71e36dbb31dadfba27e4e306f5f59fc3d0a2db89f7839f746d514b0b9efdeb32238a0d50477663c8c046825f32c7b43e7b599b3fad8023256c3a
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.6.2 (June 11, 2014)
2
+
3
+ * Provide ignore_classes to stop collecting wait time on specific worker classes
4
+
1
5
  ## 0.6.1 (June 9, 2014)
2
6
 
3
7
  * Bug fix - do not process wait time when timestamp doesn't exist
data/README.rdoc CHANGED
@@ -15,6 +15,11 @@ Wait is somewhat tricky, as Resque doesn't provide the proper hooks to calculate
15
15
  replace Resque's push method, and Job initialization method. These methods now add a timestamp when items are added
16
16
  to queues, and use the timestamp to calculate the total wait time, when an item is taken out of the queue.
17
17
 
18
+ Note that wait time calculation changes the Resque object that is placed in the queues. It means that code that relies on
19
+ object's exact value will fail. A known conflict is with ts-resque-delta[https://rubygems.org/gems/ts-resque-delta] which
20
+ deletes all queued jobs that have the same key. Adding a timestamp to each key, makes them unique, and conflicts with the
21
+ keys deletion. See the usage section below for further details.
22
+
18
23
  == Installation
19
24
 
20
25
  Requires resque '~> 1.25.1', and googlecharts '~> 1.6.8'
@@ -39,6 +44,10 @@ Extend Resque workers with:
39
44
 
40
45
  On the Resque screens, you will find a new tab called "Analytics".
41
46
 
47
+ If you wish to stop collection wait time for certain classes, add the following to your resque.rb initializer:
48
+ Resque::Plugins::Analytics.ignore_classes = ['worker_class', ...]
49
+ where worker class represents a job class for which you do not want to collect wait time metrics.
50
+
42
51
  == TODO
43
52
 
44
53
  * Add tests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -3,7 +3,7 @@ require 'resque'
3
3
  module Resque
4
4
  # Override Resque's push method to add a timestemp to each enqueued item
5
5
  def push(queue, item)
6
- item['analytics_timestamp'] = Time.now if item.is_a?(Hash)
6
+ item['analytics_timestamp'] = Time.now if item.is_a?(Hash) && !Resque::Plugins::Analytics.ignore_classes.include?(item[:class])
7
7
  redis.pipelined do
8
8
  watch_queue(queue)
9
9
  redis.rpush "queue:#{queue}", encode(item)
@@ -31,6 +31,14 @@ module Resque
31
31
 
32
32
  EXPIRE = 90 * 24 * 60
33
33
 
34
+ def self.ignore_classes=(class_array)
35
+ @ignore_classes = class_array
36
+ end
37
+
38
+ def self.ignore_classes
39
+ @ignore_classes || []
40
+ end
41
+
34
42
  def key(kpi)
35
43
  date = Time.now.strftime("%y_%m_%d")
36
44
  "analytics:#{kpi}:#{self.name}:#{date}"
Binary file
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: resque-analytics 0.6.1 ruby lib
5
+ # stub: resque-analytics 0.6.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "resque-analytics"
9
- s.version = "0.6.1"
9
+ s.version = "0.6.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Nir Tzur"]
13
- s.date = "2014-06-09"
13
+ s.date = "2014-06-11"
14
14
  s.description = "Shows Resque jobs key performance indciators over time"
15
15
  s.email = "nir.tzur@samanage.com"
16
16
  s.extra_rdoc_files = [
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  "lib/resque-analytics/server.rb",
31
31
  "lib/resque-analytics/server/views/analytics.erb",
32
32
  "lib/resque/plugins/analytics.rb",
33
- "resque-analytics-0.6.0.gem",
33
+ "resque-analytics-0.6.1.gem",
34
34
  "resque-analytics.gemspec"
35
35
  ]
36
36
  s.homepage = "http://github.com/nirtzur/resque-analytics"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nir Tzur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque
@@ -100,7 +100,7 @@ files:
100
100
  - lib/resque-analytics/server.rb
101
101
  - lib/resque-analytics/server/views/analytics.erb
102
102
  - lib/resque/plugins/analytics.rb
103
- - resque-analytics-0.6.0.gem
103
+ - resque-analytics-0.6.1.gem
104
104
  - resque-analytics.gemspec
105
105
  homepage: http://github.com/nirtzur/resque-analytics
106
106
  licenses:
Binary file