resque-metrics 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +34 -6
- data/Rakefile +0 -10
- data/VERSION +1 -1
- data/lib/resque/metrics.rb +15 -5
- data/resque-metrics.gemspec +12 -11
- metadata +25 -45
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fa7c797cdfa6560213452323b8342776c660999d
|
4
|
+
data.tar.gz: fb437d501c22eb5092ba201460ab8bcce56d91a5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60ec3b407be33f70cf96737e5334d1ce0c707f8c6c5e82314be33e66f56de8231ff905c93c23000ac91478e9d99660e4c22d5e0652310c1e76f69a68ed77feb3
|
7
|
+
data.tar.gz: d26228715c7c892779c3a09b59b126046f3743f955db5243af381aa68812393395c51b222ff7a66085179ea44652b9e1fce0aed3ff0b14522ff7aba16170d7cb
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,49 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
addressable (2.3.5)
|
4
5
|
archive-tar-minitar (0.5.2)
|
6
|
+
builder (3.2.2)
|
5
7
|
columnize (0.3.4)
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
faraday (0.7.6)
|
9
|
+
addressable (~> 2.2)
|
10
|
+
multipart-post (~> 1.1)
|
11
|
+
rack (~> 1.1)
|
12
|
+
git (1.2.6)
|
13
|
+
github_api (0.4.10)
|
14
|
+
faraday (~> 0.7.6)
|
15
|
+
hashie (~> 1.2.0)
|
16
|
+
multi_json (~> 1.0)
|
17
|
+
oauth2 (~> 0.5.2)
|
18
|
+
hashie (1.2.0)
|
19
|
+
highline (1.6.20)
|
20
|
+
jeweler (2.0.1)
|
21
|
+
builder
|
22
|
+
bundler (>= 1.0)
|
9
23
|
git (>= 1.2.5)
|
24
|
+
github_api
|
25
|
+
highline (>= 1.6.15)
|
26
|
+
nokogiri (>= 1.5.10)
|
10
27
|
rake
|
28
|
+
rdoc
|
29
|
+
json (1.8.1)
|
11
30
|
linecache19 (0.5.12)
|
12
31
|
ruby_core_source (>= 0.1.4)
|
32
|
+
mini_portile (0.5.2)
|
13
33
|
minitest (2.8.0)
|
14
34
|
multi_json (1.0.3)
|
35
|
+
multipart-post (1.2.0)
|
36
|
+
nokogiri (1.6.1)
|
37
|
+
mini_portile (~> 0.5.0)
|
38
|
+
oauth2 (0.5.2)
|
39
|
+
faraday (~> 0.7)
|
40
|
+
multi_json (~> 1.0)
|
15
41
|
rack (1.3.5)
|
16
42
|
rack-protection (1.1.4)
|
17
43
|
rack
|
18
|
-
rake (
|
44
|
+
rake (10.1.1)
|
45
|
+
rdoc (4.1.1)
|
46
|
+
json (~> 1.4)
|
19
47
|
redis (2.2.2)
|
20
48
|
redis-namespace (1.0.3)
|
21
49
|
redis (< 3.0.0)
|
@@ -46,8 +74,8 @@ PLATFORMS
|
|
46
74
|
ruby
|
47
75
|
|
48
76
|
DEPENDENCIES
|
49
|
-
bundler
|
50
|
-
jeweler
|
77
|
+
bundler
|
78
|
+
jeweler
|
51
79
|
minitest (>= 2)
|
52
80
|
resque (~> 1.19)
|
53
81
|
ruby-debug19
|
data/Rakefile
CHANGED
@@ -37,13 +37,3 @@ Rake::TestTask.new(:test) do |test|
|
|
37
37
|
end
|
38
38
|
|
39
39
|
task :default => :test
|
40
|
-
|
41
|
-
require 'rake/rdoctask'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "resque-metrics #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/lib/resque/metrics.rb
CHANGED
@@ -3,8 +3,6 @@ require 'resque'
|
|
3
3
|
module Resque
|
4
4
|
module Metrics
|
5
5
|
|
6
|
-
VERSION = '0.0.1'
|
7
|
-
|
8
6
|
def self.extended(klass)
|
9
7
|
klass.extend(Hooks)
|
10
8
|
end
|
@@ -13,6 +11,14 @@ module Resque
|
|
13
11
|
::Resque.redis
|
14
12
|
end
|
15
13
|
|
14
|
+
def self.use_multi=(multi)
|
15
|
+
@_use_multi = multi
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.use_multi?
|
19
|
+
@_use_multi
|
20
|
+
end
|
21
|
+
|
16
22
|
def self.watch_fork
|
17
23
|
::Resque.before_fork = before_fork
|
18
24
|
::Resque.after_fork = after_fork
|
@@ -68,7 +74,7 @@ module Resque
|
|
68
74
|
def self.record_job_fork(job, time)
|
69
75
|
job_class = job.payload_class
|
70
76
|
queue = job.queue
|
71
|
-
|
77
|
+
multi do
|
72
78
|
increment_metric "fork_time", time
|
73
79
|
increment_metric "fork_time:queue:#{queue}", time
|
74
80
|
increment_metric "fork_time:job:#{job_class}", time
|
@@ -89,7 +95,7 @@ module Resque
|
|
89
95
|
increment_metric "enqueue_count:queue:#{queue}"
|
90
96
|
|
91
97
|
size = Resque.encode(args).length
|
92
|
-
|
98
|
+
multi do
|
93
99
|
increment_metric "payload_size", size
|
94
100
|
increment_metric "payload_size:queue:#{queue}", size
|
95
101
|
increment_metric "payload_size:job:#{job_class}", size
|
@@ -103,7 +109,7 @@ module Resque
|
|
103
109
|
|
104
110
|
def self.record_job_completion(job_class, time)
|
105
111
|
queue = Resque.queue_from_class(job_class)
|
106
|
-
|
112
|
+
multi do
|
107
113
|
increment_metric "job_time", time
|
108
114
|
increment_metric "job_time:queue:#{queue}", time
|
109
115
|
increment_metric "job_time:job:#{job_class}", time
|
@@ -117,6 +123,10 @@ module Resque
|
|
117
123
|
run_callback(:on_job_complete, job_class, queue, time)
|
118
124
|
end
|
119
125
|
|
126
|
+
def self.multi(&block)
|
127
|
+
use_multi? ? redis.multi(&block) : yield
|
128
|
+
end
|
129
|
+
|
120
130
|
def self.increment_metric(metric, by = 1)
|
121
131
|
redis.incrby("_metrics_:#{metric}", by)
|
122
132
|
end
|
data/resque-metrics.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
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-metrics 0.0.6 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "resque-metrics"
|
8
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.6"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Aaron Quint"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-02-12"
|
13
15
|
s.description = "A simple Resque plugin that times and saves some simple metrics for Resque jobs back into redis. Based on this system\nyou could build some simple auto-scaling mechanism based on the speed and ETA of queues. Also includes a hook/callback\nmechanism for recording/sending the metrics to your favorite tool (AKA statsd/graphite).\n"
|
14
16
|
s.email = "aaron@quirkey.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -33,32 +35,31 @@ Gem::Specification.new do |s|
|
|
33
35
|
]
|
34
36
|
s.homepage = "http://github.com/quirkey/resque-metrics"
|
35
37
|
s.licenses = ["MIT"]
|
36
|
-
s.
|
37
|
-
s.rubygems_version = "1.8.23"
|
38
|
+
s.rubygems_version = "2.2.1"
|
38
39
|
s.summary = "A Resque plugin for recording simple metrics for your jobs"
|
39
40
|
|
40
41
|
if s.respond_to? :specification_version then
|
41
|
-
s.specification_version =
|
42
|
+
s.specification_version = 4
|
42
43
|
|
43
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
45
|
s.add_runtime_dependency(%q<resque>, ["~> 1.19"])
|
45
46
|
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
46
47
|
s.add_development_dependency(%q<minitest>, [">= 2"])
|
47
|
-
s.add_development_dependency(%q<bundler>, ["
|
48
|
-
s.add_development_dependency(%q<jeweler>, ["
|
48
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
49
50
|
else
|
50
51
|
s.add_dependency(%q<resque>, ["~> 1.19"])
|
51
52
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
52
53
|
s.add_dependency(%q<minitest>, [">= 2"])
|
53
|
-
s.add_dependency(%q<bundler>, ["
|
54
|
-
s.add_dependency(%q<jeweler>, ["
|
54
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
55
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
55
56
|
end
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<resque>, ["~> 1.19"])
|
58
59
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
59
60
|
s.add_dependency(%q<minitest>, [">= 2"])
|
60
|
-
s.add_dependency(%q<bundler>, ["
|
61
|
-
s.add_dependency(%q<jeweler>, ["
|
61
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
62
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
metadata
CHANGED
@@ -1,105 +1,89 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Aaron Quint
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: resque
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.19'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.19'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: ruby-debug19
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: minitest
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '2'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '2'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: bundler
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
61
|
+
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
68
|
+
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: jeweler
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
75
|
+
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
94
|
-
description:
|
95
|
-
Resque jobs back into redis. Based on this system
|
96
|
-
|
97
|
-
you could build some simple auto-scaling mechanism based on the speed and ETA of
|
98
|
-
queues. Also includes a hook/callback
|
99
|
-
|
82
|
+
version: '0'
|
83
|
+
description: |
|
84
|
+
A simple Resque plugin that times and saves some simple metrics for Resque jobs back into redis. Based on this system
|
85
|
+
you could build some simple auto-scaling mechanism based on the speed and ETA of queues. Also includes a hook/callback
|
100
86
|
mechanism for recording/sending the metrics to your favorite tool (AKA statsd/graphite).
|
101
|
-
|
102
|
-
'
|
103
87
|
email: aaron@quirkey.com
|
104
88
|
executables: []
|
105
89
|
extensions: []
|
@@ -107,7 +91,7 @@ extra_rdoc_files:
|
|
107
91
|
- LICENSE.txt
|
108
92
|
- README.rdoc
|
109
93
|
files:
|
110
|
-
- .document
|
94
|
+
- ".document"
|
111
95
|
- Gemfile
|
112
96
|
- Gemfile.lock
|
113
97
|
- LICENSE.txt
|
@@ -123,29 +107,25 @@ files:
|
|
123
107
|
homepage: http://github.com/quirkey/resque-metrics
|
124
108
|
licenses:
|
125
109
|
- MIT
|
110
|
+
metadata: {}
|
126
111
|
post_install_message:
|
127
112
|
rdoc_options: []
|
128
113
|
require_paths:
|
129
114
|
- lib
|
130
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
116
|
requirements:
|
133
|
-
- -
|
117
|
+
- - ">="
|
134
118
|
- !ruby/object:Gem::Version
|
135
119
|
version: '0'
|
136
|
-
segments:
|
137
|
-
- 0
|
138
|
-
hash: -517852637179208795
|
139
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
121
|
requirements:
|
142
|
-
- -
|
122
|
+
- - ">="
|
143
123
|
- !ruby/object:Gem::Version
|
144
124
|
version: '0'
|
145
125
|
requirements: []
|
146
126
|
rubyforge_project:
|
147
|
-
rubygems_version:
|
127
|
+
rubygems_version: 2.2.1
|
148
128
|
signing_key:
|
149
|
-
specification_version:
|
129
|
+
specification_version: 4
|
150
130
|
summary: A Resque plugin for recording simple metrics for your jobs
|
151
131
|
test_files: []
|