kurchatov 0.2.2 → 0.2.3

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: 9094918f08537775203d52e22d3669276a8e3cee
4
- data.tar.gz: d775c33d9a51f5e5fa5e87a0fef7a874218e5657
3
+ metadata.gz: dbbbae27bc63fa4d288964473a0c40f7c5d287de
4
+ data.tar.gz: b7b563070302caaef9fccfd31b418327c32c13c5
5
5
  SHA512:
6
- metadata.gz: 7bdf806068549afe1a9f2519ef954effe5561b1ecda9acde8179c7aa210484168de07bb21a503690fc97b4eea2ad46f40ed6fda8c692585b29ff21ac6c7d0857
7
- data.tar.gz: d6f752f13bc30d1c65707462e078566fe527f3661128551286b0c1ea2bec911c65e288f15dbb509bbd3317bc9329f39b3ed697df653a109433a26078b7b39a68
6
+ metadata.gz: bf3a30e95ed5120216b5eca71954d66ddd4d66e2c8ba894d3fdb4b04530030fdd8143848a0351cc50694737450b08f2f6a69f8d62f76bd002afa706960baccc3
7
+ data.tar.gz: ec916fe27d1cdbd386e2854f1bcc2d620f265eaf4cb57a072cdc5383b97fb67eebb305d50007f7d595f0eb65a116714104bf1e57c6b49567551d39896c490422
data/CHANGELOG CHANGED
@@ -5,3 +5,5 @@
5
5
  * Version 0.0.6.pre.5: Improve http responder, add monitor
6
6
  * Version 0.0.6: ruby 1.8.7 support
7
7
  * Version 0.0.7: add FreeBSD support, responders as plugins
8
+ * Version 0.2.1: count avg metric
9
+ * Version 0.2.3: ignore_errors as count errors
@@ -12,6 +12,7 @@ module Kurchatov
12
12
  @count_errors = 0
13
13
  @last_error = nil
14
14
  @last_error_at = nil
15
+ @last_error_count = 0
15
16
  end
16
17
 
17
18
  def name
@@ -34,15 +35,17 @@ module Kurchatov
34
35
  return false if @thread.alive?
35
36
  # thread died, join and extract error
36
37
  begin
38
+ @last_error_count = 0
37
39
  @thread.join # call error
38
40
  rescue => e
39
41
  desc = "Plugin '#{@plugin.name}' died. #{e.class}: #{e}\n." +
40
42
  "Trace: #{e.backtrace.join("\n")}"
41
43
  @count_errors += 1
44
+ @last_error_count += 1
42
45
  @last_error = desc
43
46
  @last_error_at = Time.now
44
47
  Log.error(desc)
45
- unless @plugin.ignore_errors
48
+ if @plugin.ignore_errors == false || (@plugin.ignore_errors.class == 'Fixnum' && @plugin.ignore_errors > @plugin.last_error_count)
46
49
  event(:service => "plugin #{@plugin.name} errors", :desc => desc, :state => 'critical')
47
50
  end
48
51
  end
@@ -1,3 +1,3 @@
1
1
  module Kurchatov
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -0,0 +1,5 @@
1
+ name "dont start plugin"
2
+
3
+ collect do
4
+ raise "Don't start me!!"
5
+ end
@@ -0,0 +1,8 @@
1
+ name "with error plugin"
2
+
3
+ ignore_errors true
4
+ always_start true
5
+
6
+ collect do
7
+ raise "error"
8
+ end
@@ -0,0 +1,8 @@
1
+ name "plugin with error count"
2
+
3
+ ignore_errors 4
4
+ always_start true
5
+
6
+ collect do
7
+ raise "error"
8
+ end
data/tests/server.rb CHANGED
@@ -2,7 +2,7 @@ require 'socket'
2
2
  require 'timeout'
3
3
  require 'kurchatov/riemann/client'
4
4
  require 'yaml'
5
- require_relative 'testreceived'
5
+ require File.expand_path('../testreceived', __FILE__)
6
6
 
7
7
  PORT = 5555
8
8
  HOST = '127.0.0.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kurchatov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasiliev Dmitry
@@ -193,8 +193,11 @@ files:
193
193
  - lib/ohai/plugins/windows/platform.rb
194
194
  - tests/data/config.yml
195
195
  - tests/data/event.yml
196
- - tests/data/required.rb
197
- - tests/data/sample.rb
196
+ - tests/data/plugin_dont_start.rb
197
+ - tests/data/plugin_sample.rb
198
+ - tests/data/plugin_with_errors.rb
199
+ - tests/data/plugin_with_errors_with_count.rb
200
+ - tests/data/plugin_with_no_required.rb
198
201
  - tests/run.sh
199
202
  - tests/server.rb
200
203
  - tests/testreceived.rb
File without changes