riemann-sidekiq 0.0.1 → 0.0.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: bda7bcb4728e2f9fc45491684b268fdd5fa40d09
4
- data.tar.gz: e220952e136e26661a41ed66cd3d1e862fb6ddfe
3
+ metadata.gz: 64b5a4eb917fdb2ff04423c3681b52499bf09397
4
+ data.tar.gz: 26612dbed307498cade5ef68ea24987d5804b774
5
5
  SHA512:
6
- metadata.gz: 77a2029b0424228244a3451334918207f537a7b9fdbe16a1712ec3833b307cf55f158cbfeb264115d96e2715312f3206eb53e1f4fe69074ea5de388517dee6cd
7
- data.tar.gz: c39ae576f6f0be34b78e3cff5d683910679d1b98eab44d217cb25f4006df67aeb3523851c24263806bf8c051a8380288d312754540a8da9fa57a9d2438f004f7
6
+ metadata.gz: 10f51368674d42e083bfa4d20046ca0f51bef261050bed9d846bb639b82a4f64089cbc7feff606092d079a43b351a84528ee008e767dfa88032877c681c92f5c
7
+ data.tar.gz: e058e5a03a66085402718891744db70c47abfe5bbfa904c99f03a5cbc420f39ff4428a2f362142026a077881dbd6fb01ae4ef6210af86b48ef70ae44e2faf352
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ Riemann Rpush
2
+ =============
3
+
4
+ Riemann Rpush agent.
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Riemann agent to collect Rpush metrics
4
+
5
+ require 'sidekiq'
6
+ require 'sidekiq/api'
7
+ require 'riemann/tools'
8
+
9
+ class Riemann::Tools::Sidekiq
10
+ include Riemann::Tools
11
+
12
+ opt :sidekiq_url, "Sidekiq URL"
13
+ opt :sidekiq_namespace, "Sidekiq namespace"
14
+ opt :enqueued_warning, "Enqueued size warning threshold", :type => Integer, :default => 100
15
+ opt :enqueued_critical, "Enqueued size critical threshold", :type => Integer, :default => 500
16
+
17
+ def initialize
18
+ ::Sidekiq.configure_client do |config|
19
+ config.redis = { url: opts[:sidekiq_url], namespace: opts[:sidekiq_namespace] }
20
+ end
21
+
22
+ ::Sidekiq.configure_server do |config|
23
+ config.redis = { url: opts[:sidekiq_url], namespace: opts[:sidekiq_namespace] }
24
+ end
25
+
26
+ @enqueued_warning = opts.fetch(:enqueued_warning)
27
+ @enqueued_critical = opts.fetch(:enqueued_critical)
28
+ @stats = ::Sidekiq::Stats.new
29
+ end
30
+
31
+ def tick
32
+ begin
33
+ %w(processed failed enqueued scheduled_size retry_size dead_size).each do |m|
34
+ metric = @stats.send(m)
35
+
36
+ state = if m.eql?("enqueued") && m >= @enqueued_critical
37
+ 'critical'
38
+ elsif m.eql?("enqueued") && m >= @enqueued_warning
39
+ 'warning'
40
+ else
41
+ 'ok'
42
+ end
43
+
44
+ report(
45
+ service: "sidekiq #{m}",
46
+ metric: metric,
47
+ state: state
48
+ )
49
+ end
50
+
51
+ @stats.queues.each do |name, metric|
52
+ report(
53
+ service: "sidekiq queues #{name}",
54
+ metric: metric
55
+ )
56
+ end
57
+ rescue => e
58
+ puts e
59
+ end
60
+ end
61
+ end
62
+
63
+ Riemann::Tools::Sidekiq.run
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "riemann-sidekiq"
7
+ spec.version = '0.0.2'
8
+ spec.authors = ["Fernando Alonso"]
9
+ spec.email = ["krakatoa1987@gmail.com"]
10
+ spec.summary = %q{Riemann agent to collect Sidekiq metrics}
11
+ spec.description = %q{Riemann agent to collect Sidekiq metrics}
12
+ spec.homepage = "https://github.com/krakatoa/riemann-sidekiq"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "riemann-tools", "~> 0.2.6"
21
+ spec.add_runtime_dependency 'redis', '~> 3.2'
22
+ spec.add_runtime_dependency 'sidekiq', '~> 3.3'
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Alonso
@@ -69,10 +69,16 @@ dependencies:
69
69
  description: Riemann agent to collect Sidekiq metrics
70
70
  email:
71
71
  - krakatoa1987@gmail.com
72
- executables: []
72
+ executables:
73
+ - riemann-sidekiq
73
74
  extensions: []
74
75
  extra_rdoc_files: []
75
- files: []
76
+ files:
77
+ - .gitignore
78
+ - LICENSE
79
+ - README.md
80
+ - bin/riemann-sidekiq
81
+ - riemann-sidekiq.gemspec
76
82
  homepage: https://github.com/krakatoa/riemann-sidekiq
77
83
  licenses:
78
84
  - MIT