rookout 0.1.2 → 0.1.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
  SHA256:
3
- metadata.gz: 559c0c4b76d3815a418977ebe848a66f9640128be5a900286afedbf658a26e1e
4
- data.tar.gz: dfeb5ba84b8b6665de0b0c1e5dec2fe687c3cb420485664f4d626bbb24213c7a
3
+ metadata.gz: ff23aa23db05a25f0bfa7f20ef0d7969d2b26d1a3480667f6165c95d4530ddc7
4
+ data.tar.gz: 4e5f6d7b5e9f34aa4cc9cd98c9b73152e7b25f73b49f02ee668d1f676ca8046e
5
5
  SHA512:
6
- metadata.gz: d83bee904b048be0d9d4c221b2e5c797fa61a24a0dd43666b7211b8a5df917581aab351874cc819de11c853e08044454625d75d59594b197f8792d61e84f6d3c
7
- data.tar.gz: e59f969f44d7f8311dbb96c7724be58900b45d294ce868742baf468856cbeba9219b14e67a32985619e98af895676df0fcc89ac6828fd89ac75b66d0d04f084b
6
+ metadata.gz: 658f60902cf42a6935b368d96ee466f3f0c2e341bf773961ced22d7a6bf706ccbc64ed91ea52c4bbf3df1a53bfec49f54c5285c99799494b1aca8fcee49c7593
7
+ data.tar.gz: 641ece8d6554713fa18e1b5c6999cb2b8783cd1e49114bee1ffc4843198cac6f4fca90f3f85a59781485c1d7017ee7047aaaf8c7ed94af0ec78d17d1668e9ba7
@@ -7,6 +7,7 @@ module Rookout
7
7
  require_relative "actions/action_run_processor"
8
8
  require_relative "conditions/condition"
9
9
  require_relative "locations/location_file_line"
10
+ require_relative "locations/location_exception_handler"
10
11
  require_relative "aug_rate_limiter"
11
12
  require_relative "aug"
12
13
 
@@ -45,9 +46,15 @@ module Rookout
45
46
  def create_location configuration, aug
46
47
  name = configuration["name"]
47
48
  raise Exceptions.RookObjectNameMissing if name.nil?
48
- raise Exceptions.RookUnsupportedLocation if name != "file_line"
49
49
 
50
- Locations::LocationFileLine.new configuration, @output, aug
50
+ case name
51
+ when "file_line"
52
+ return Locations::LocationFileLine.new configuration, @output, aug
53
+ when "exception_handler"
54
+ return Locations::LocationExceptionHandler.new configuration, @output, aug
55
+ else
56
+ raise Exceptions.RookUnsupportedLocation if name != "file_line"
57
+ end
51
58
  end
52
59
 
53
60
  def create_rate_limit configuration
@@ -2,6 +2,8 @@ module Rookout
2
2
  module Augs
3
3
  require_relative "../logger"
4
4
 
5
+ require_relative "../processor/rook_error"
6
+
5
7
  require_relative "aug_factory"
6
8
 
7
9
  class AugsManager
@@ -43,7 +45,7 @@ module Rookout
43
45
  return
44
46
  end
45
47
 
46
- error = RookError.new e, message
48
+ error = Rookout::Processor::RookError.new e, message
47
49
  @output.send_rule_status aug_id, "Error", error
48
50
  return
49
51
  end
@@ -0,0 +1,22 @@
1
+ module Rookout
2
+ module Augs
3
+ require_relative "../../logger"
4
+
5
+ require_relative "../../processor/rook_error"
6
+
7
+ module Locations
8
+ require_relative "location"
9
+
10
+ class LocationExceptionHandler < Location
11
+ NAME = "exception_handler".freeze
12
+
13
+ def initialize _arguments, output, aug
14
+ super output, aug
15
+ end
16
+
17
+ def add_aug _trigger_services
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -57,19 +57,13 @@ module Rookout
57
57
  return if @closing || !@agent_com
58
58
 
59
59
  @rule_status_update_bucket.if_available do
60
- protobuf_error = nil
60
+ status = Com::Rookout::RuleStatusMessage.new agent_id: @agent_id,
61
+ rule_id: rule_id,
62
+ active: active
61
63
  if error
62
- protobuf_error = Com::Rookout::Error.new message: error.message,
63
- type: error.type
64
- protobuf_error.parameters.copy_from error.parameters
65
- protobuf_error.exc.copy_from error.exc
66
- protobuf_error.traceback.copy_from error.traceback
64
+ status.error = error.dumps
67
65
  end
68
66
 
69
- status = Com::Rookout::RuleStatusMessage.new agent_id: @agent_id,
70
- rule_id: rule_id,
71
- active: active,
72
- error: protobuf_error
73
67
  @agent_com.add status
74
68
  end
75
69
  end
@@ -84,7 +84,7 @@ module Rookout
84
84
  raise RookMissingToken if token.nil? && host == "wss://control.rookout.com"
85
85
  verify_token token if token
86
86
 
87
- labels = options[:labels] || parse_labels(ENV["ROOKOUT_LABELS"])
87
+ labels = stringify_labels(options[:labels]) || parse_labels(ENV["ROOKOUT_LABELS"])
88
88
  validate_labels labels
89
89
 
90
90
  async_start = true? ENV["ROOKOUT_ASYNC_START"]
@@ -108,6 +108,18 @@ module Rookout
108
108
  default
109
109
  end
110
110
 
111
+ def stringify_labels labels
112
+ return nil unless labels
113
+
114
+ stringified_labels = {}
115
+
116
+ labels.each do |label_name, label_value|
117
+ stringified_labels[label_name.to_s] = label_value.to_s
118
+ end
119
+
120
+ stringified_labels
121
+ end
122
+
111
123
  def parse_labels raw_labels
112
124
  labels = {}
113
125
  return labels if raw_labels.nil?
@@ -98,7 +98,7 @@ module Rookout
98
98
  lineno = find_updated_line filename, location
99
99
  return if lineno == -1
100
100
 
101
- PositionMarker.new location.lineno, iseq
101
+ PositionMarker.new lineno, iseq
102
102
  elsif suggested_match? location, filename
103
103
  warning = Exceptions::RookSourceFilePathSuggestion.new location.filename, filename
104
104
  location.notify_warning warning
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rookout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liran Haimovitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-07 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -197,6 +197,7 @@ files:
197
197
  - lib/rookout/augs/augs_manager.rb
198
198
  - lib/rookout/augs/conditions/condition.rb
199
199
  - lib/rookout/augs/locations/location.rb
200
+ - lib/rookout/augs/locations/location_exception_handler.rb
200
201
  - lib/rookout/augs/locations/location_file_line.rb
201
202
  - lib/rookout/com_ws/agent_com_ws.rb
202
203
  - lib/rookout/com_ws/backoff.rb