komachi_heartbeat 2.1.4 → 2.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1f36fb59434d775367692fde238f5634bcd371e
|
4
|
+
data.tar.gz: 7c8165c671542407deef0aeaa0929bb37f503afe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd337e5867f1cef835d9b85374be7e8049e13227722b1b9c46902a6daa8eaafefcf2bd0638262608f06286b8b95c9c394a6e71c279e7eac65daa64b36047af1
|
7
|
+
data.tar.gz: 5917e40b2904dca5211ab7bd80d7c07319a38a05f44ff0ce0915f2a43f3b4a499c70c75373c8042828a66fa8af8f98b318b976a346faa1b52465ba8ed5e26331
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module KomachiHeartbeat
|
2
|
+
class StatsController < ApplicationController
|
3
|
+
def worker
|
4
|
+
return head :not_found unless worker_stats_enabled?
|
5
|
+
render json: worker_stats
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def worker_stats
|
11
|
+
if defined?(Sidekiq)
|
12
|
+
sidekiq_stats
|
13
|
+
elsif defined?(Resque)
|
14
|
+
resque_stats
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def sidekiq_stats
|
19
|
+
stats = Sidekiq::Stats.new
|
20
|
+
{ enqueued: stats.enqueued, processed: stats.processed }
|
21
|
+
end
|
22
|
+
|
23
|
+
def resque_stats
|
24
|
+
unless Resque.respond_to?(:pending_queues)
|
25
|
+
Resque.class_eval {
|
26
|
+
def pending_queues
|
27
|
+
queues.inject(0) { |m,k| m + size(k) }
|
28
|
+
end
|
29
|
+
}
|
30
|
+
end
|
31
|
+
{ enqueued: Resque.pending_queues, processed: Resque::Stat[:processed]}
|
32
|
+
end
|
33
|
+
|
34
|
+
def worker_stats_enabled?
|
35
|
+
KomachiHeartbeat.config.worker_stats_enabled
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module KomachiHeartbeat
|
2
2
|
class Config
|
3
3
|
include ActiveSupport::Configurable
|
4
|
-
config_accessor :application_version, :application_name, :db_check_enabled, :redis_check_enabled, :memcached_check_enabled, :database_class_names, :memcached_server_names, :redis_servers
|
4
|
+
config_accessor :application_version, :application_name, :db_check_enabled, :redis_check_enabled, :memcached_check_enabled, :database_class_names, :memcached_server_names, :redis_servers, :worker_stats_enabled
|
5
5
|
|
6
6
|
configure do |config|
|
7
7
|
config.application_name = "Unknown"
|
@@ -14,6 +14,8 @@ module KomachiHeartbeat
|
|
14
14
|
|
15
15
|
config.memcached_check_enabled = false
|
16
16
|
config.memcached_server_names = ["localhost"]
|
17
|
+
|
18
|
+
config.worker_stats_enabled = false
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: komachi_heartbeat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takumi MIURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- app/assets/stylesheets/komachi_heartbeat/application.css
|
165
165
|
- app/controllers/komachi_heartbeat/application_controller.rb
|
166
166
|
- app/controllers/komachi_heartbeat/heartbeat_controller.rb
|
167
|
+
- app/controllers/komachi_heartbeat/stats_controller.rb
|
167
168
|
- app/helpers/komachi_heartbeat/application_helper.rb
|
168
169
|
- app/helpers/komachi_heartbeat/heartbeat_helper.rb
|
169
170
|
- app/views/layouts/komachi_heartbeat/application.html.erb
|