snowman-io 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/snowman-io/api/agent.rb +1 -1
- data/lib/snowman-io/launcher.rb +2 -2
- data/lib/snowman-io/loop/checks.rb +3 -1
- data/lib/snowman-io/loop/main.rb +6 -4
- data/lib/snowman-io/loop/spiders.rb +28 -0
- data/lib/snowman-io/migration.rb +5 -0
- data/lib/snowman-io/models/app.rb +13 -0
- data/lib/snowman-io/ui/assets/ui-d190960e7df2e7119d592ffd60a19ee9.css +1 -0
- data/lib/snowman-io/ui/assets/ui-eaac3f6e07b933b851c15ff3329643cb.js +8 -0
- data/lib/snowman-io/ui/index.html +3 -3
- data/lib/snowman-io/version.rb +1 -1
- data/lib/snowman-io.rb +1 -1
- metadata +5 -5
- data/lib/snowman-io/loop/ping.rb +0 -25
- data/lib/snowman-io/ui/assets/ui-0e39dafcb798020fb855e325931c8451.css +0 -1
- data/lib/snowman-io/ui/assets/ui-d362f30d01b07ba93506380bca1f84c6.js +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 993cfb726c05ae3df7b9fe3f2d5d87c280e0656c
|
4
|
+
data.tar.gz: 0e85d2abb1479874175dfe943ec7a2819e1c56e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 894676ae87f7dbfc119499639b332c94eb8044ab53afe667ccc39e81d812627323ddc6ce36cc38ca6a08b0ab1d65be6d52b145e1169ef6552e02167c3a119ed5
|
7
|
+
data.tar.gz: 97e3977a240677f93368a50c773f5be4d114b908c1832c2c10c508d6c10c27f69ec96c420e7a7e67eb1620c39ac61192ed44e2289e0ab6b5eb92f497cd22deb9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# SnowmanIO
|
2
2
|
|
3
|
+
Version 0.2.0 - 2015.09.08
|
4
|
+
- Remove self ping loop (Heroku doesn't have free plans without sleeping no more)
|
5
|
+
- Update metric main pages
|
6
|
+
- Add application for internal metrics and measure duration of checks performing and aggregations
|
7
|
+
- Add mongo metrics
|
8
|
+
|
3
9
|
Version 0.1.0 - 2015.07.11
|
4
10
|
- Remove daily reports
|
5
11
|
- Cover almost all server code with specs
|
data/lib/snowman-io/api/agent.rb
CHANGED
@@ -13,7 +13,7 @@ module SnowmanIO
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
post "metrics" do
|
16
|
-
if app = App.where(token: permitted_params[:token]).first
|
16
|
+
if app = App.where(system: false, token: permitted_params[:token]).first
|
17
17
|
processed = 0
|
18
18
|
accepted = 0
|
19
19
|
(permitted_params[:metrics] || []).each do |metric|
|
data/lib/snowman-io/launcher.rb
CHANGED
@@ -10,15 +10,15 @@ module SnowmanIO
|
|
10
10
|
Migration.new.migrate
|
11
11
|
app = Rack::Cascade.new [API::Root, Web]
|
12
12
|
@web_server = WebServer.supervise_as(:web_server, app, @options.slice(:port, :host, :verbose))
|
13
|
-
@ping = Loop::Ping.supervise_as(:ping)
|
14
13
|
@main = Loop::Main.supervise_as(:main)
|
15
14
|
@checks = Loop::Checks.supervise_as(:checks)
|
15
|
+
@spiders = Loop::Spiders.supervise_as(:checks)
|
16
16
|
end
|
17
17
|
|
18
18
|
def stop
|
19
|
+
@spiders.terminate
|
19
20
|
@checks.terminate
|
20
21
|
@main.terminate
|
21
|
-
@ping.terminate
|
22
22
|
@web_server.terminate # TODO: shutdown blocking?
|
23
23
|
end
|
24
24
|
end
|
data/lib/snowman-io/loop/main.rb
CHANGED
@@ -15,10 +15,12 @@ module SnowmanIO
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def perform
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
App.time "Aggregation Time" do
|
19
|
+
Aggregate.metrics_aggregate_5min
|
20
|
+
Aggregate.metrics_aggregate_hour
|
21
|
+
Aggregate.metrics_aggregate_daily
|
22
|
+
Aggregate.metrics_clean_old
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SnowmanIO
|
2
|
+
module Loop
|
3
|
+
class Spiders
|
4
|
+
include Celluloid
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
after(5) { tick }
|
8
|
+
end
|
9
|
+
|
10
|
+
def tick
|
11
|
+
App.time "Spiders Performing Time" do
|
12
|
+
perform
|
13
|
+
end
|
14
|
+
after(30) { tick }
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def perform
|
20
|
+
# store mongo metrics
|
21
|
+
stats = Mongoid::Sessions.default.command(dbstats: 1)
|
22
|
+
App.value("Mongo dataSize", stats["dataSize"])
|
23
|
+
App.value("Mongo storageSize", stats["storageSize"])
|
24
|
+
App.value("Mongo nsSizeMB", stats["nsSizeMB"])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/snowman-io/migration.rb
CHANGED
@@ -64,6 +64,11 @@ module SnowmanIO
|
|
64
64
|
@db[:snowman_io_users].find.update_all("$unset" => {"daily_report" => 1})
|
65
65
|
end
|
66
66
|
|
67
|
+
migration "add sys app" do
|
68
|
+
@db[:snowman_io_apps].find.update_all("$set" => {"system" => false})
|
69
|
+
@db[:snowman_io_apps].insert(name: "Snowman", system: true)
|
70
|
+
end
|
71
|
+
|
67
72
|
SnowmanIO.logger.info "Migration done"
|
68
73
|
end
|
69
74
|
|
@@ -7,6 +7,7 @@ module SnowmanIO
|
|
7
7
|
|
8
8
|
field :name, type: String
|
9
9
|
field :token, type: String
|
10
|
+
field :system, type: Boolean, default: false
|
10
11
|
|
11
12
|
validates :name, :token, presence: true
|
12
13
|
|
@@ -14,6 +15,18 @@ module SnowmanIO
|
|
14
15
|
self.token = generate_token(:token)
|
15
16
|
end
|
16
17
|
|
18
|
+
def self.time(name, &block)
|
19
|
+
sys = App.where(system: true).first
|
20
|
+
start = Time.now.to_f
|
21
|
+
yield
|
22
|
+
sys.register_metric_value(name, "time", Time.now.to_f - start, Time.now)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.value(name, v)
|
26
|
+
sys = App.where(system: true).first
|
27
|
+
sys.register_metric_value(name, "amount", v, Time.now)
|
28
|
+
end
|
29
|
+
|
17
30
|
def as_json(options = {})
|
18
31
|
super(options.merge(methods: [:datapoints, :metric_ids])).tap do |o|
|
19
32
|
o["id"] = o.delete("_id").to_s
|
@@ -0,0 +1 @@
|
|
1
|
+
.navbar{border-radius:0!important}.navbar-brand:hover{color:#9d9d9d!important}.nav-sidebar{margin-left:-30px;margin-top:-20px}.nav-sidebar>li>a{border-radius:0!important}.app-slot table td,.app-slot table th{text-align:center}.app-slot .yesterday{color:#999}.panel-custom{margin-top:35px}.check-status.green{font-weight:700;color:green}.check-status.red{font-weight:700;color:red}.big{font-size:42px;font-weight:700}.checks-failed{background-color:#f5f5f5}.container-main{padding-bottom:48px}
|