resque-alarm 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +6 -3
- data/lib/resque/plugins/alarm_notifier/log_notifier.rb +3 -2
- metadata +10 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 745e2e9fcf68cc1f9326ca00ae6e067950c1d9e1
|
4
|
+
data.tar.gz: 3472b3c2a376da2da495eb6b689f6334259b95f1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0bc44333a9c9f157c23a5bfaecae78b7c5ab424016d42c2f55394332f3ab1605143b425eac1bdbb457e36e936f26074a771bb061683e302cb451fddbf760a6e1
|
7
|
+
data.tar.gz: 9894d2df95784b49dceccb96de9b3eba65ecef4d46a841c20a7d59e13cb23a4ec02d8a925362de4f5078785b89eaa3a59247168ab46c2a8e23450e16769a4fb0
|
data/README.md
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
Resque Alarm
|
2
2
|
===========
|
3
3
|
|
4
|
-
Send out an alarm (at this time, just support email) when queue length reach a threshold.
|
4
|
+
Send out an alarm (at this time, just support email, logger) when queue length reach a threshold.
|
5
5
|
|
6
6
|
To use this gem, config in an initializer
|
7
7
|
|
8
8
|
require 'resque/plugins/alarm'
|
9
9
|
require 'resque/plugins/alarm_notifier/log_notifier'
|
10
|
+
# OR
|
10
11
|
require 'resque/plugins/alarm_notifier/mail_notifier'
|
11
12
|
|
12
13
|
Resque::Plugins::Alarm.configure do |config|
|
13
14
|
config.threshold = 10 # Perform notify when queue have more than 10 items
|
14
|
-
config.notifier = Resque::Plugins::AlarmNotifier::LogNotifier.new(Rails.logger, :info) # Notify to rails log
|
15
|
+
config.notifier = Resque::Plugins::AlarmNotifier::LogNotifier.new(Rails.logger, :info, "MyFantasticApp") # Notify to rails log
|
15
16
|
# OR using mail notifier
|
16
17
|
config.notifier = Resque::Plugins::AlarmNotifier::MailNotifier.new(
|
17
18
|
"from@from.com",
|
@@ -37,7 +38,9 @@ Extend in job:
|
|
37
38
|
|
38
39
|
While enqueueing, if any queue has more than 10 items, a log as below will be written to rails log
|
39
40
|
|
40
|
-
{:app=>"
|
41
|
+
{:app=>"MyFantasticApp", :source=>"resque-queue-length-alarm", :type=>"resque_queue_too_long", :queues=>{:artwork_file_serve=>11}}
|
42
|
+
|
43
|
+
Email may be very noisy, it's better to use rails log and let log system decide email threshold.
|
41
44
|
|
42
45
|
=========
|
43
46
|
AV
|
@@ -2,9 +2,10 @@ module Resque
|
|
2
2
|
module Plugins
|
3
3
|
module AlarmNotifier
|
4
4
|
class LogNotifier
|
5
|
-
def initialize(logger = nil, level = :info)
|
5
|
+
def initialize(logger = nil, level = :info, app_name = "app")
|
6
6
|
@logger = logger
|
7
7
|
@level = level.to_sym
|
8
|
+
@app_name = app_name
|
8
9
|
end
|
9
10
|
def notify(params)
|
10
11
|
return unless @logger.respond_to?(@level)
|
@@ -13,7 +14,7 @@ module Resque
|
|
13
14
|
|
14
15
|
private
|
15
16
|
def format(params)
|
16
|
-
{ app:
|
17
|
+
{ app: @app_name, source: "resque-queue-length-alarm", type: "resque_queue_too_long", queues: params}
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
metadata
CHANGED
@@ -1,54 +1,52 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-alarm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- AnVo
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: A Resque plugin to alarm when queue is too long. Using email or rails
|
15
14
|
log, or others log system. Use other tools to analyze result. Queue is checked
|
16
15
|
every time job enqueued.
|
17
|
-
email:
|
16
|
+
email: thien.an.vo.nguyen@gmail.com
|
18
17
|
executables: []
|
19
18
|
extensions: []
|
20
19
|
extra_rdoc_files: []
|
21
20
|
files:
|
21
|
+
- LICENSE
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
|
-
- LICENSE
|
25
24
|
- lib/resque/plugins/alarm.rb
|
26
25
|
- lib/resque/plugins/alarm_notifier/alarm.html.erb
|
27
26
|
- lib/resque/plugins/alarm_notifier/log_notifier.rb
|
28
27
|
- lib/resque/plugins/alarm_notifier/mail_notifier.rb
|
29
|
-
homepage: https://github.com/
|
28
|
+
homepage: https://github.com/anvox/resque-alarm
|
30
29
|
licenses: []
|
30
|
+
metadata: {}
|
31
31
|
post_install_message:
|
32
32
|
rdoc_options: []
|
33
33
|
require_paths:
|
34
34
|
- lib
|
35
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
-
none: false
|
37
36
|
requirements:
|
38
|
-
- -
|
37
|
+
- - '>='
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '0'
|
41
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
41
|
requirements:
|
44
|
-
- -
|
42
|
+
- - '>='
|
45
43
|
- !ruby/object:Gem::Version
|
46
44
|
version: '0'
|
47
45
|
requirements: []
|
48
46
|
rubyforge_project:
|
49
|
-
rubygems_version:
|
47
|
+
rubygems_version: 2.4.8
|
50
48
|
signing_key:
|
51
|
-
specification_version:
|
49
|
+
specification_version: 4
|
52
50
|
summary: A Resque plugin to alarm when queue is too long.
|
53
51
|
test_files: []
|
54
52
|
has_rdoc: false
|