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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e582711a3847fef089ccfbc950dfbce1c36fe4fc
4
- data.tar.gz: a1160bf7102d58dfce882ca37fe3d719fbad831b
3
+ metadata.gz: 993cfb726c05ae3df7b9fe3f2d5d87c280e0656c
4
+ data.tar.gz: 0e85d2abb1479874175dfe943ec7a2819e1c56e4
5
5
  SHA512:
6
- metadata.gz: c8df6d214fae6b3bae1f27d09b208f4d17923875a156e123c1a21b3e2486998ae1b36b09862b5dceeb68e0a96fea35984cf6190d8d06080d4a151c566c7c4b11
7
- data.tar.gz: 840be04724b4c5a727af9eb9ca0142e580124f4c0d0a30d46f1817a696bfc01daab0feb981da071f638d650a3dbbe03e3aa5f36215df53c7d2a2f88b34029bb5
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
@@ -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|
@@ -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
@@ -11,7 +11,9 @@ module SnowmanIO
11
11
  end
12
12
 
13
13
  def tick
14
- ChecksPerform.perform
14
+ App.time "Checks Performing Time" do
15
+ ChecksPerform.perform
16
+ end
15
17
  after(3) { tick }
16
18
  end
17
19
  end
@@ -15,10 +15,12 @@ module SnowmanIO
15
15
  private
16
16
 
17
17
  def perform
18
- Aggregate.metrics_aggregate_5min
19
- Aggregate.metrics_aggregate_hour
20
- Aggregate.metrics_aggregate_daily
21
- Aggregate.metrics_clean_old
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
@@ -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}