activeadmin_sidekiq_stats 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9199c993e311e1c78536e770b56c65aa9dd726ee
4
+ data.tar.gz: ed72954a3857ac26252d977c9b33607f6e70b3de
5
+ SHA512:
6
+ metadata.gz: 3dc5e69e37ab4f6fb5c96bf426fc2371f7576a1414a4cfb65f66b7c2827ee9ca0ff0685edbe53ae8d94f705b36bfc89eeb41bbfa7247f16016ccc9044235b811
7
+ data.tar.gz: 7139c1c0d3a512fd4efd74c65f0b20d179ee1e827075093e25029c8be7ce8b1a6ff71712264453761e9fccaa28f273d3041aea26d32f35eda8bdce1d66c957c3
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in activeadmin_sidekiq_stats.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Bilal Budhani
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # ActiveadminSidekiqStats
2
+
3
+ Get an overview of Sidekiq stats in ActiveAdmin dashboard.
4
+ ![](https://raw.githubusercontent.com/BilalBudhani/activeadmin_sidekiq_stats/master/dashboard_screenshot.png)
5
+
6
+ # Motivation
7
+ I found myself switch dashboards to keep up with the stats of Sidekiq with other business/application metrics. I was looking for single point of information.
8
+
9
+ ## Installation
10
+
11
+ ```ruby
12
+ gem 'activeadmin_sidekiq_stats'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ ## Usage
20
+
21
+ in your `admin/dashboard.rb` inside `content` block add
22
+
23
+ ```ruby
24
+ columns do
25
+ column do
26
+ ActiveAdminSidekiqStats::Panel.inject
27
+ end
28
+ end
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bilalbudhani/activeadmin_sidekiq_stats.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,26 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "activeadmin_sidekiq_stats/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "activeadmin_sidekiq_stats"
8
+ spec.version = ActiveadminSidekiqStats::VERSION
9
+ spec.authors = ["Bilal Budhani"]
10
+ spec.email = ["bilal@bilalbudhani.com"]
11
+
12
+ spec.summary = %q{Sidekiq Stats In ActiveAdmin Dashboard}
13
+ spec.description = %q{Sidekiq Stats In ActiveAdmin Dashboard}
14
+ spec.homepage = "https://github.com/bilalbudhani/activeadmin_sidekiq_stats"
15
+ spec.license = "MIT"
16
+
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency("activeadmin", ">= 1.1.0")
24
+ spec.add_dependency("arbre", ">= 1.1.1")
25
+ spec.add_dependency("sidekiq", ">= 4.0.0")
26
+ end
Binary file
@@ -0,0 +1,6 @@
1
+ require "activeadmin_sidekiq_stats/version"
2
+ require "activeadmin_sidekiq_stats/panel"
3
+
4
+ module ActiveadminSidekiqStats
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,45 @@
1
+ module ActiveAdminSidekiqStats
2
+
3
+ class Panel
4
+
5
+ def self.inject
6
+ klass = new
7
+ klass.inject!
8
+ end
9
+
10
+ def inject!
11
+ html = Arbre::Context.new do
12
+ panel "Sidekiq Stats" do
13
+ begin
14
+ sidekiq = JSON.parse(::Sidekiq::Stats.new.to_json)
15
+ stats = sidekiq.fetch("stats", Hash.new)
16
+ div style: "display: flex; justify-content: center; align-items: center" do
17
+ stats.each do |process_name, process_value|
18
+ div style: "display: flex; flex:1; justify-content: center; align-items: center; flex-direction: column" do
19
+ h1 process_value
20
+ span process_name
21
+ end
22
+ end
23
+ end
24
+ rescue Redis::CannotConnectError
25
+ h1 "Redis Connection Failed"
26
+ end
27
+ end
28
+ end
29
+ html.to_s
30
+ end
31
+
32
+ private
33
+
34
+ def container_style
35
+ "display: flex; justify-content: center; align-items: center"
36
+ end
37
+
38
+ def item_style
39
+ "flex:1; justify-content: center;"
40
+ end
41
+
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveadminSidekiqStats
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeadmin_sidekiq_stats
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bilal Budhani
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeadmin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: arbre
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: sidekiq
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 4.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 4.0.0
55
+ description: Sidekiq Stats In ActiveAdmin Dashboard
56
+ email:
57
+ - bilal@bilalbudhani.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - activeadmin_sidekiq_stats.gemspec
68
+ - dashboard_screenshot.png
69
+ - lib/activeadmin_sidekiq_stats.rb
70
+ - lib/activeadmin_sidekiq_stats/panel.rb
71
+ - lib/activeadmin_sidekiq_stats/version.rb
72
+ homepage: https://github.com/bilalbudhani/activeadmin_sidekiq_stats
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.6.13
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Sidekiq Stats In ActiveAdmin Dashboard
96
+ test_files: []