rearview 1.0.3.rc.2-jruby → 1.0.3.rc.3-jruby

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: 3744958da5dc786968bec824c0f887eb2f830876
4
- data.tar.gz: a46f47e85e051a51bcc28085c05dc2528fe5bb6a
3
+ metadata.gz: 8d18574480d2cb164b05a399d03d8471f0a2eb86
4
+ data.tar.gz: 536a96e7c77dbdd0249713fa36fcd2e5b1a54cf1
5
5
  SHA512:
6
- metadata.gz: 086eb370fccee36e0457022fd2db8b8d1bc4e979d0006d0cdbf055bb859f9d7a36816ad1df29bbe304e276ac26aa19298d1df10c8e5e543711a34659cc21f6f7
7
- data.tar.gz: a15d0ae42515823411197192b5c54515b71ed3a4f4e505e5da02717fecfb1c5ad668683bcc1261ccc5c1710499739434fa3e8fda2f35241696effada796b2c75
6
+ metadata.gz: e7894d65ca93d5e9ffd6b9a82e325b21a267806bc7a83ade90883063c8150a8a450a5bfe5f04629d0fd0652a4e1eca58e04bf58fcbc2bc09f2f576e87b826916
7
+ data.tar.gz: eec2f7f6dbb2f9a290534408c6cc8faa5d3e2281934f7f87f466f97acc54b3a133ede123a17b6ec22dc387e44727d3ed5fd178728f8356aca291b378c1bd1de6
@@ -140,6 +140,7 @@ module Rearview
140
140
 
141
141
  def create_associated_event(transition)
142
142
  logger.debug "#{self}#create_associated_event for transition #{transition.inspect}"
143
+ report_transition(transition)
143
144
  job_error_attrs = {}
144
145
  job_error_attrs.merge!(event_data[:job_error]) if event_data.try(:[],:job_error)
145
146
  job_error = job_errors.create(job_error_attrs)
@@ -148,6 +149,7 @@ module Rearview
148
149
 
149
150
  def update_associated_event(transition)
150
151
  logger.debug "#{self}#update_associated_event for transition #{transition.inspect}"
152
+ report_transition(transition)
151
153
  job_error = Rearview::JobError.latest_entry(self)
152
154
  if job_error.present?
153
155
  job_error.fire_event(translate_associated_event(transition),event_data)
@@ -156,6 +158,15 @@ module Rearview
156
158
 
157
159
  protected
158
160
 
161
+ def report_transition(transition)
162
+ Rearview::Statsd.report do |stats|
163
+ metric = ( transition.event.to_s == 'success' ? 'success' : 'failure' )
164
+ stats.increment("monitor.#{metric}")
165
+ end
166
+ rescue
167
+ logger.error "#{self} report_transition failed: #{$!}\n#{$@.join("\n")}"
168
+ end
169
+
159
170
  def translate_associated_event(transition)
160
171
  if transition.event.to_s == Status::SECURITY_ERROR
161
172
  :error
@@ -5,6 +5,10 @@ module Rearview
5
5
  include Rearview::Logger
6
6
  def statsd
7
7
  @statsd ||= Rearview::Statsd.new
8
+ if block_given? && Rearview.config.stats_enabled?
9
+ yield @statsd
10
+ end
11
+ @statsd
8
12
  end
9
13
  def started?
10
14
  @started
@@ -15,7 +15,7 @@ module Rearview
15
15
  # safest max UDP message size is 512.
16
16
  #
17
17
  # So make sure that batch_size * 8bytes/per int < 512
18
- @statsd.batch_size = 11
18
+ @statsd.batch_size = 12
19
19
  schedule if start
20
20
  end
21
21
 
@@ -39,6 +39,7 @@ module Rearview
39
39
  batch.gauge('vm.non_heap.init',vm.non_heap.init.bytes_to_kilobytes)
40
40
  batch.gauge('vm.non_heap.max',vm.non_heap.max.bytes_to_kilobytes)
41
41
  batch.gauge('vm.non_heap.used',vm.non_heap.used.bytes_to_kilobytes)
42
+ batch.gauge('monitor.total',( Rearview.config.monitor_enabled? ? Rearview.monitor_service.jobs.keys.count : 0 ))
42
43
  end
43
44
  rescue
44
45
  error "#{self} run failed: #{$!}\n#{$@.join("\n")}"
@@ -6,6 +6,16 @@ module Rearview
6
6
  self.namespace = Rearview.config.statsd_connection[:namespace]
7
7
  end
8
8
 
9
+ def self.statsd
10
+ @@statsd ||= Rearview::Statsd.new
11
+ end
12
+
13
+ def self.report
14
+ if block_given? && Rearview.config.stats_enabled?
15
+ yield self.statsd
16
+ end
17
+ end
18
+
9
19
  end
10
20
  end
11
21
 
@@ -1,3 +1,3 @@
1
1
  module Rearview
2
- VERSION = "1.0.3.rc.2"
2
+ VERSION = "1.0.3.rc.3"
3
3
  end
@@ -239,3 +239,75 @@
239
239
   (13.0ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
240
240
   (2.0ms) SELECT version FROM `schema_migrations`
241
241
   (2.0ms) INSERT INTO `schema_migrations` (version) VALUES ('20131106162900')
242
+  (88.0ms) DROP DATABASE IF EXISTS `rearview_ruby_test`
243
+  (7.0ms) CREATE DATABASE `rearview_ruby_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`
244
+  (66.0ms) CREATE TABLE `applications` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255) NOT NULL, `created_at` datetime, `updated_at` datetime, `deleted_at` datetime, `ancestry` varchar(255), `description` varchar(255)) ENGINE=InnoDB DEFAULT CHARSET=utf8
245
+  (18.0ms) CREATE INDEX `index_applications_on_ancestry` ON `applications` (`ancestry`)
246
+  (14.0ms) CREATE INDEX `user_id` ON `applications` (`user_id`)
247
+  (14.0ms) CREATE TABLE `job_data` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11) DEFAULT 0 NOT NULL, `created_at` datetime, `updated_at` datetime, `data` longtext NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
248
+  (9.0ms) CREATE TABLE `job_errors` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11), `created_at` datetime, `message` longtext, `status` varchar(255), `last_alerted_at` datetime, `updated_at` datetime) ENGINE=InnoDB DEFAULT CHARSET=utf8
249
+  (9.0ms) CREATE INDEX `job_id` ON `job_errors` (`job_id`)
250
+  (18.0ms) CREATE TABLE `jobs` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `name` varchar(255) NOT NULL, `active` tinyint(1) DEFAULT 1 NOT NULL, `last_run` datetime, `cron_expr` varchar(1024) NOT NULL, `status` varchar(255), `user_id` int(11), `alert_keys` text, `deleted_at` datetime, `error_timeout` int(11) DEFAULT 60 NOT NULL, `next_run` datetime, `description` text, `app_id` int(11) NOT NULL, `metrics` text NOT NULL, `monitor_expr` text, `minutes` int(11), `to_date` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
251
+  (11.0ms) CREATE INDEX `app_id` ON `jobs` (`app_id`)
252
+  (12.0ms) CREATE UNIQUE INDEX `id_name_version_key` ON `jobs` (`id`, `name`)
253
+  (17.0ms) CREATE INDEX `jobs_ibfk_1` ON `jobs` (`user_id`)
254
+  (8.0ms) CREATE TABLE `users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `encrypted_password` varchar(255) DEFAULT '' NOT NULL, `email` varchar(255) NOT NULL, `first_name` varchar(255), `last_name` varchar(255), `last_login` datetime, `preferences` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
255
+  (10.0ms) CREATE UNIQUE INDEX `email` ON `users` (`email`)
256
+  (16.0ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
257
+  (13.0ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
258
+  (4.0ms) SELECT version FROM `schema_migrations`
259
+  (3.0ms) INSERT INTO `schema_migrations` (version) VALUES ('20131106162900')
260
+  (8.0ms) DROP DATABASE IF EXISTS `rearview_ruby_test`
261
+  (1.0ms) CREATE DATABASE `rearview_ruby_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`
262
+  (16.0ms) CREATE TABLE `applications` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255) NOT NULL, `created_at` datetime, `updated_at` datetime, `deleted_at` datetime, `ancestry` varchar(255), `description` varchar(255)) ENGINE=InnoDB DEFAULT CHARSET=utf8
263
+  (10.0ms) CREATE INDEX `index_applications_on_ancestry` ON `applications` (`ancestry`)
264
+  (9.0ms) CREATE INDEX `user_id` ON `applications` (`user_id`)
265
+  (10.0ms) CREATE TABLE `job_data` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11) DEFAULT 0 NOT NULL, `created_at` datetime, `updated_at` datetime, `data` longtext NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
266
+  (8.0ms) CREATE TABLE `job_errors` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11), `created_at` datetime, `message` longtext, `status` varchar(255), `last_alerted_at` datetime, `updated_at` datetime) ENGINE=InnoDB DEFAULT CHARSET=utf8
267
+  (9.0ms) CREATE INDEX `job_id` ON `job_errors` (`job_id`)
268
+  (8.0ms) CREATE TABLE `jobs` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `name` varchar(255) NOT NULL, `active` tinyint(1) DEFAULT 1 NOT NULL, `last_run` datetime, `cron_expr` varchar(1024) NOT NULL, `status` varchar(255), `user_id` int(11), `alert_keys` text, `deleted_at` datetime, `error_timeout` int(11) DEFAULT 60 NOT NULL, `next_run` datetime, `description` text, `app_id` int(11) NOT NULL, `metrics` text NOT NULL, `monitor_expr` text, `minutes` int(11), `to_date` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
269
+  (10.0ms) CREATE INDEX `app_id` ON `jobs` (`app_id`)
270
+  (9.0ms) CREATE UNIQUE INDEX `id_name_version_key` ON `jobs` (`id`, `name`)
271
+  (12.0ms) CREATE INDEX `jobs_ibfk_1` ON `jobs` (`user_id`)
272
+  (15.0ms) CREATE TABLE `users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `encrypted_password` varchar(255) DEFAULT '' NOT NULL, `email` varchar(255) NOT NULL, `first_name` varchar(255), `last_name` varchar(255), `last_login` datetime, `preferences` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
273
+  (8.0ms) CREATE UNIQUE INDEX `email` ON `users` (`email`)
274
+  (14.0ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
275
+  (11.0ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
276
+  (1.0ms) SELECT version FROM `schema_migrations`
277
+  (2.0ms) INSERT INTO `schema_migrations` (version) VALUES ('20131106162900')
278
+  (12.0ms) DROP DATABASE IF EXISTS `rearview_ruby_test`
279
+  (1.0ms) CREATE DATABASE `rearview_ruby_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`
280
+  (42.0ms) CREATE TABLE `applications` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255) NOT NULL, `created_at` datetime, `updated_at` datetime, `deleted_at` datetime, `ancestry` varchar(255), `description` varchar(255)) ENGINE=InnoDB DEFAULT CHARSET=utf8
281
+  (10.0ms) CREATE INDEX `index_applications_on_ancestry` ON `applications` (`ancestry`)
282
+  (9.0ms) CREATE INDEX `user_id` ON `applications` (`user_id`)
283
+  (12.0ms) CREATE TABLE `job_data` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11) DEFAULT 0 NOT NULL, `created_at` datetime, `updated_at` datetime, `data` longtext NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
284
+  (9.0ms) CREATE TABLE `job_errors` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11), `created_at` datetime, `message` longtext, `status` varchar(255), `last_alerted_at` datetime, `updated_at` datetime) ENGINE=InnoDB DEFAULT CHARSET=utf8
285
+  (9.0ms) CREATE INDEX `job_id` ON `job_errors` (`job_id`)
286
+  (19.0ms) CREATE TABLE `jobs` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `name` varchar(255) NOT NULL, `active` tinyint(1) DEFAULT 1 NOT NULL, `last_run` datetime, `cron_expr` varchar(1024) NOT NULL, `status` varchar(255), `user_id` int(11), `alert_keys` text, `deleted_at` datetime, `error_timeout` int(11) DEFAULT 60 NOT NULL, `next_run` datetime, `description` text, `app_id` int(11) NOT NULL, `metrics` text NOT NULL, `monitor_expr` text, `minutes` int(11), `to_date` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
287
+  (10.0ms) CREATE INDEX `app_id` ON `jobs` (`app_id`)
288
+  (10.0ms) CREATE UNIQUE INDEX `id_name_version_key` ON `jobs` (`id`, `name`)
289
+  (18.0ms) CREATE INDEX `jobs_ibfk_1` ON `jobs` (`user_id`)
290
+  (14.0ms) CREATE TABLE `users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `encrypted_password` varchar(255) DEFAULT '' NOT NULL, `email` varchar(255) NOT NULL, `first_name` varchar(255), `last_name` varchar(255), `last_login` datetime, `preferences` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
291
+  (17.0ms) CREATE UNIQUE INDEX `email` ON `users` (`email`)
292
+  (15.0ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
293
+  (11.0ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
294
+  (2.0ms) SELECT version FROM `schema_migrations`
295
+  (2.0ms) INSERT INTO `schema_migrations` (version) VALUES ('20131106162900')
296
+  (34.0ms) DROP DATABASE IF EXISTS `rearview_ruby_test`
297
+  (7.0ms) CREATE DATABASE `rearview_ruby_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`
298
+  (65.0ms) CREATE TABLE `applications` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255) NOT NULL, `created_at` datetime, `updated_at` datetime, `deleted_at` datetime, `ancestry` varchar(255), `description` varchar(255)) ENGINE=InnoDB DEFAULT CHARSET=utf8
299
+  (9.0ms) CREATE INDEX `index_applications_on_ancestry` ON `applications` (`ancestry`)
300
+  (21.0ms) CREATE INDEX `user_id` ON `applications` (`user_id`)
301
+  (27.0ms) CREATE TABLE `job_data` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11) DEFAULT 0 NOT NULL, `created_at` datetime, `updated_at` datetime, `data` longtext NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
302
+  (16.0ms) CREATE TABLE `job_errors` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `job_id` int(11), `created_at` datetime, `message` longtext, `status` varchar(255), `last_alerted_at` datetime, `updated_at` datetime) ENGINE=InnoDB DEFAULT CHARSET=utf8
303
+  (16.0ms) CREATE INDEX `job_id` ON `job_errors` (`job_id`)
304
+  (23.0ms) CREATE TABLE `jobs` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `name` varchar(255) NOT NULL, `active` tinyint(1) DEFAULT 1 NOT NULL, `last_run` datetime, `cron_expr` varchar(1024) NOT NULL, `status` varchar(255), `user_id` int(11), `alert_keys` text, `deleted_at` datetime, `error_timeout` int(11) DEFAULT 60 NOT NULL, `next_run` datetime, `description` text, `app_id` int(11) NOT NULL, `metrics` text NOT NULL, `monitor_expr` text, `minutes` int(11), `to_date` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
305
+  (10.0ms) CREATE INDEX `app_id` ON `jobs` (`app_id`)
306
+  (20.0ms) CREATE UNIQUE INDEX `id_name_version_key` ON `jobs` (`id`, `name`)
307
+  (17.0ms) CREATE INDEX `jobs_ibfk_1` ON `jobs` (`user_id`)
308
+  (24.0ms) CREATE TABLE `users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` datetime, `encrypted_password` varchar(255) DEFAULT '' NOT NULL, `email` varchar(255) NOT NULL, `first_name` varchar(255), `last_name` varchar(255), `last_login` datetime, `preferences` text) ENGINE=InnoDB DEFAULT CHARSET=utf8
309
+  (17.0ms) CREATE UNIQUE INDEX `email` ON `users` (`email`)
310
+  (25.0ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
311
+  (12.0ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
312
+  (1.0ms) SELECT version FROM `schema_migrations`
313
+  (4.0ms) INSERT INTO `schema_migrations` (version) VALUES ('20131106162900')