resque-analytics 0.6.2 → 0.6.3

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: e009321250d82eaca1eddd22e9d9ffd4fcca1652
4
- data.tar.gz: ec141d2a85a1e9fb3208bf1bff59f0b42429dce9
3
+ metadata.gz: 17ae0b32a8358b7f91cbec473ec1ce6262eb42c9
4
+ data.tar.gz: 15252ab1873d1204e8c09d1fe01bd83623bd6a26
5
5
  SHA512:
6
- metadata.gz: 23504a44a8604a81611391abc5bc27a6b876cc8b353b8cf22fead4cf98ef8c4fe19ecd886d302a1e47cdb7d4259aa44bd347e06ea1201808464a74fadb808846
7
- data.tar.gz: 1911eb9a179f71e36dbb31dadfba27e4e306f5f59fc3d0a2db89f7839f746d514b0b9efdeb32238a0d50477663c8c046825f32c7b43e7b599b3fad8023256c3a
6
+ metadata.gz: a1abe2a07366bf72ea85e6f80726f4379f0305f65f0412eb0cdc668efc73fefaffb4d0efd1ff62d288f2b7bffc530eba48c0d3d7ca18b6e0ce363d4298c07e6d
7
+ data.tar.gz: 5bb4c49cf4b2560315eca59e70519e931858db7debc64e5b0eed3d7502cba13db08768829f2fc76984a6a66b68690ffc8c3e793c8225f8fadab00e10d5684b5f
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.6.3 (June 23, 2014)
2
+
3
+ * Add ability to select worker jobs on index screen
4
+
1
5
  ## 0.6.2 (June 11, 2014)
2
6
 
3
7
  * Provide ignore_classes to stop collecting wait time on specific worker classes
data/README.rdoc CHANGED
@@ -46,6 +46,7 @@ On the Resque screens, you will find a new tab called "Analytics".
46
46
 
47
47
  If you wish to stop collection wait time for certain classes, add the following to your resque.rb initializer:
48
48
  Resque::Plugins::Analytics.ignore_classes = ['worker_class', ...]
49
+
49
50
  where worker class represents a job class for which you do not want to collect wait time metrics.
50
51
 
51
52
  == TODO
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
@@ -4,13 +4,22 @@
4
4
  Various KPIs related to Resque jobs
5
5
  </p>
6
6
 
7
- <% @data.keys.each do |job| %>
8
- <h2><%= job %></h2>
9
- <% performed = chart_data(@data, job, Resque::Plugins::Analytics::PERFORMED) %>
10
- <% failed = chart_data(@data, job, Resque::Plugins::Analytics::FAILED) %>
11
- <%= chart_it("Number of jobs", [Resque::Plugins::Analytics::PERFORMED, Resque::Plugins::Analytics::FAILED], [performed, failed]) %>
7
+ <form action='analytics', method='get'>
8
+ <label>Select Job</label>
9
+ <select name="job">
10
+ <% measured_jobs.each do |job| %>
11
+ <% selected = job == @job ? 'selected="selected"' : '' %>
12
+ <option value="<%= job %>"<%= selected %>><%= job %></option>
13
+ <% end %>
14
+ </select>
15
+ <input type="submit" />
16
+ </form>
12
17
 
13
- <% run_time = chart_data(@data, job, Resque::Plugins::Analytics::TOTAL_TIME) %>
14
- <% wait_time = chart_data(@data, job, Resque::Plugins::Analytics::WAIT_TIME) %>
15
- <%= chart_it("Wait and Run times", [Resque::Plugins::Analytics::WAIT_TIME, Resque::Plugins::Analytics::TOTAL_TIME], [wait_time, run_time]) %>
16
- <% end %>
18
+ <h2><%= @job %></h2>
19
+ <% performed = chart_data(@data, Resque::Plugins::Analytics::PERFORMED) %>
20
+ <% failed = chart_data(@data, Resque::Plugins::Analytics::FAILED) %>
21
+ <%= chart_it("Number of jobs", [Resque::Plugins::Analytics::PERFORMED, Resque::Plugins::Analytics::FAILED], [performed, failed]) %>
22
+
23
+ <% run_time = chart_data(@data, Resque::Plugins::Analytics::TOTAL_TIME) %>
24
+ <% wait_time = chart_data(@data, Resque::Plugins::Analytics::WAIT_TIME) %>
25
+ <%= chart_it("Wait and Run times", [Resque::Plugins::Analytics::WAIT_TIME, Resque::Plugins::Analytics::TOTAL_TIME], [wait_time, run_time]) %>
@@ -29,8 +29,8 @@ module Resque
29
29
  @legend_keys ||= (-90..0).map { |number| number.days.from_now.strftime("%y_%m_%d")}
30
30
  end
31
31
 
32
- def chart_data(data, job, kpi)
33
- legend_keys.map { |key| @data[job][kpi][key].to_i || 0 }
32
+ def chart_data(data, kpi)
33
+ legend_keys.map { |key| @data[kpi][key].to_i || 0 }
34
34
  end
35
35
 
36
36
  def chart_it(title, legend, data)
@@ -52,11 +52,10 @@ module Resque
52
52
  class << self
53
53
  def registered(app)
54
54
  app.get '/analytics' do
55
- @data = measured_jobs.inject({}) { |res, job|
56
- res[job] = {}
57
- [PERFORMED, FAILED, TOTAL_TIME, WAIT_TIME].each { |kpi| res[job][kpi] = counters_for(job, kpi) }
58
- res
59
- }
55
+ @job = params[:job] || measured_jobs.first
56
+
57
+ @data = {}
58
+ [PERFORMED, FAILED, TOTAL_TIME, WAIT_TIME].each { |kpi| @data[kpi] = counters_for(@job, kpi) }
60
59
  erb(File.read(File.join(VIEW_PATH, 'analytics.erb')))
61
60
  end
62
61
 
@@ -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.2 ruby lib
5
+ # stub: resque-analytics 0.6.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "resque-analytics"
9
- s.version = "0.6.2"
9
+ s.version = "0.6.3"
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-11"
13
+ s.date = "2014-06-23"
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,6 @@ 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.1.gem",
34
33
  "resque-analytics.gemspec"
35
34
  ]
36
35
  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.2
4
+ version: 0.6.3
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-11 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque
@@ -100,7 +100,6 @@ 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.1.gem
104
103
  - resque-analytics.gemspec
105
104
  homepage: http://github.com/nirtzur/resque-analytics
106
105
  licenses:
Binary file