rookout 0.1.0 → 0.1.56

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rookout/atfork.rb +73 -0
  3. data/lib/rookout/augs/actions/action_run_processor.rb +4 -3
  4. data/lib/rookout/augs/aug.rb +33 -91
  5. data/lib/rookout/augs/aug_factory.rb +94 -27
  6. data/lib/rookout/augs/aug_rate_limiter.rb +50 -47
  7. data/lib/rookout/augs/augs_manager.rb +3 -1
  8. data/lib/rookout/augs/conditions/condition.rb +4 -2
  9. data/lib/rookout/augs/limits_manager.rb +32 -0
  10. data/lib/rookout/augs/locations/location.rb +75 -1
  11. data/lib/rookout/augs/locations/location_exception_handler.rb +22 -0
  12. data/lib/rookout/augs/locations/location_file_line.rb +21 -5
  13. data/lib/rookout/com_ws/agent_com_ws.rb +97 -58
  14. data/lib/rookout/com_ws/backoff.rb +5 -10
  15. data/lib/rookout/com_ws/command_handler.rb +1 -1
  16. data/lib/rookout/com_ws/envelope_wrapper.rb +68 -0
  17. data/lib/rookout/com_ws/git.rb +1 -1
  18. data/lib/rookout/com_ws/information.rb +95 -4
  19. data/lib/rookout/com_ws/output.rb +69 -21
  20. data/lib/rookout/com_ws/pinger.rb +41 -0
  21. data/lib/rookout/com_ws/websocket_client.rb +173 -0
  22. data/lib/rookout/commit.rb +3 -0
  23. data/lib/rookout/config.rb +94 -18
  24. data/lib/rookout/exceptions.rb +147 -12
  25. data/lib/rookout/interface.rb +95 -32
  26. data/lib/rookout/logger.rb +39 -10
  27. data/lib/rookout/processor/namespace_serializer.rb +2 -2
  28. data/lib/rookout/processor/namespace_serializer2.rb +331 -0
  29. data/lib/rookout/processor/namespaces/container_namespace.rb +5 -0
  30. data/lib/rookout/processor/namespaces/frame_namespace.rb +20 -17
  31. data/lib/rookout/processor/namespaces/namespace.rb +3 -2
  32. data/lib/rookout/processor/namespaces/noop_namespace.rb +4 -8
  33. data/lib/rookout/processor/namespaces/ruby_object_namespace.rb +39 -22
  34. data/lib/rookout/processor/namespaces/ruby_object_serializer.rb +15 -12
  35. data/lib/rookout/processor/namespaces/ruby_utils_namespace.rb +0 -4
  36. data/lib/rookout/processor/namespaces/stack_namespace.rb +6 -4
  37. data/lib/rookout/processor/namespaces/traceback_namespace.rb +13 -9
  38. data/lib/rookout/processor/operations/set_operation.rb +6 -1
  39. data/lib/rookout/processor/paths/arithmetic_path.rb +5 -3
  40. data/lib/rookout/processor/paths/canopy/actions.rb +5 -1
  41. data/lib/rookout/processor/paths/canopy/consts.rb +6 -4
  42. data/lib/rookout/processor/paths/canopy/maps.rb +286 -286
  43. data/lib/rookout/processor/paths/canopy/markers.rb +35 -4
  44. data/lib/rookout/processor/processor_factory.rb +0 -2
  45. data/lib/rookout/processor/rook_error.rb +6 -1
  46. data/lib/rookout/protobuf/controller_info_pb.rb +1 -0
  47. data/lib/rookout/protobuf/messages_pb.rb +54 -0
  48. data/lib/rookout/protobuf/variant2_pb.rb +42 -0
  49. data/lib/rookout/protobuf/variant_pb.rb +22 -0
  50. data/lib/rookout/rookout_singleton.rb +23 -5
  51. data/lib/rookout/sanitizer.rb +22 -0
  52. data/lib/rookout/services/position.rb +92 -75
  53. data/lib/rookout/services/tracer.rb +30 -16
  54. data/lib/rookout/start.rb +12 -0
  55. data/lib/rookout/trigger_services.rb +2 -2
  56. data/lib/rookout/user_warnings.rb +2 -0
  57. data/lib/rookout/utils.rb +34 -0
  58. data/lib/rookout/version.rb +1 -2
  59. data/lib/rookout.rb +4 -0
  60. metadata +77 -51
@@ -1,7 +1,6 @@
1
1
  module Rookout
2
2
  module Services
3
- require "binding_of_caller"
4
- include BindingOfCaller::BindingExtensions
3
+ require_relative "../logger"
5
4
 
6
5
  class Tracer
7
6
  def initialize
@@ -15,19 +14,25 @@ module Rookout
15
14
  aug_trace_points = []
16
15
  positions.each do |position|
17
16
  trace_point = create_trace_point aug
18
-
19
17
  begin
20
18
  trace_point.enable target: position.method, target_line: position.lineno
21
- rescue ArgumentError => e
22
- raise Exceptions::RookSetTracepointFailed, position.lineno, e
19
+ rescue RuntimeError, ArgumentError => e
20
+ trace_point.disable # just to make sure if something was partially added to clear everything
21
+ if e.message.include? "can not enable any hooks"
22
+ raise Exceptions::RookInvalidPositionException.new(aug.filename, position.lineno)
23
+ end
24
+ raise Exceptions::RookSetTracepointFailed.new(position.lineno, e)
25
+ ensure
26
+ # We add and remove a dummy trace point to re-align the tracing mechanism as a result of some bug in adding
27
+ # a breakpoint https://bugs.ruby-lang.org/issues/17302
28
+ begin
29
+ dummy_trace_point = TracePoint.new(:line) {} # Dummy
30
+ dummy_trace_point.enable target: position.method, target_line: position.lineno
31
+ dummy_trace_point.disable
32
+ rescue
33
+ # IGNORE
34
+ end
23
35
  end
24
-
25
- # We add and remove a dummy trace point to re-align the tracing mechanism as a result of some bug in adding
26
- # a breakpoint
27
- dummy_trace_point = TracePoint.new(:line) {}
28
- dummy_trace_point.enable target: position.method, target_line: position.lineno
29
- dummy_trace_point.disable
30
-
31
36
  aug_trace_points.push trace_point
32
37
  end
33
38
 
@@ -51,7 +56,7 @@ module Rookout
51
56
  end
52
57
 
53
58
  def clear_augs
54
- @augs.values.each do |aug_id|
59
+ @augs.each_value do |aug_id|
55
60
  remove_aug aug_id
56
61
  end
57
62
 
@@ -66,12 +71,21 @@ module Rookout
66
71
  private
67
72
 
68
73
  def create_trace_point aug
69
- TracePoint.new :line do
74
+ TracePoint.new :line do |tp|
70
75
  begin
71
76
  begin
72
- aug.execute BindingOfCaller::BindingExtensions.callers, nil
77
+ # tp.binding - Binding object of the frame in the location that triggered the TracePoint.
78
+ # This allows us to collect locals.
79
+ # caller_locations - returns the stacktrace. Allows us to collect files, lines and function names.
80
+ # We used to also collect the Bindings up the stack (allowed us to also collect locals up the stack),
81
+ # but we don't actually need that. If we'll ever need this functionality again, we'll have to use the
82
+ # binding_of_caller gem:
83
+ # require "binding_of_caller"
84
+ # include BindingOfCaller::BindingExtensions
85
+ # callers_bindings = callers - The "callers" function retrieves the bindings up the stack
86
+ aug.execute tp.binding, caller_locations, nil
73
87
  rescue Exception => e
74
- Logger.instance.exception "Exception while evaluating script", e
88
+ Logger.instance.exception "Exception calling aug", e
75
89
  end
76
90
  rescue
77
91
  # Don't leak any exception from here
@@ -0,0 +1,12 @@
1
+ module Rookout
2
+ module RookoutStart
3
+ module_function
4
+
5
+ def on_import options = {}
6
+ require_relative "../rookout"
7
+ Rookout.start options
8
+ end
9
+ end
10
+ end
11
+
12
+ Rookout::RookoutStart.on_import
@@ -17,8 +17,8 @@ module Rookout
17
17
  @services.each_value { |service| service.remove_aug aug_id }
18
18
  end
19
19
 
20
- def clear_augs aug_id
21
- @services.each_value { |service| service.clear_augs aug_id }
20
+ def clear_augs
21
+ @services.each_value(&:clear_augs)
22
22
  end
23
23
 
24
24
  def start
@@ -21,5 +21,7 @@ module Rookout
21
21
  aug = Thread.current[TLS_KEY]
22
22
  aug.notify_error error unless aug.nil?
23
23
  end
24
+
25
+ module_function :with, :notify_warning, :notify_error
24
26
  end
25
27
  end
@@ -0,0 +1,34 @@
1
+ module Rookout
2
+ module Utils
3
+ require "securerandom"
4
+ require_relative "config"
5
+
6
+ module_function
7
+
8
+ def uuid
9
+ SecureRandom.uuid.gsub(/-/, "")
10
+ end
11
+
12
+ def milliseconds_to_nanoseconds milliseconds
13
+ nano = milliseconds * (10**6)
14
+ nano.to_i
15
+ end
16
+
17
+ def time_to_nanoseconds time_obj
18
+ secs = time_obj.to_i
19
+ nsecs = time_obj.nsec
20
+ ((10**9) * secs) + nsecs
21
+ end
22
+
23
+ def quiet_puts msg
24
+ # rubocop:disable Style/StderrPuts
25
+ return if Config.quiet
26
+ $stderr.puts msg
27
+ # rubocop:enable Style/StderrPuts
28
+ end
29
+
30
+ def is_number? string
31
+ true if Float(string) rescue false
32
+ end
33
+ end
34
+ end
@@ -1,4 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.0".freeze
3
- COMMIT = "CommitGoesHere".freeze
2
+ VERSION = "0.1.56".freeze
4
3
  end
data/lib/rookout.rb CHANGED
@@ -2,6 +2,10 @@ module Rookout
2
2
  module_function
3
3
 
4
4
  def start options = {}
5
+ require_relative "rookout/sanitizer"
6
+ Sanitizer.sanitize_object! options
7
+ Sanitizer.sanitize_properties!
8
+
5
9
  require_relative "rookout/interface"
6
10
  Interface.instance.start options
7
11
  end
metadata CHANGED
@@ -1,183 +1,197 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rookout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.56
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-11-10 00:00:00.000000000 Z
11
+ date: 2023-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: binding_of_caller
14
+ name: concurrent-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: concurrent-ruby
28
+ name: websocket-driver
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.1'
33
+ version: 0.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.1'
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: kontena-websocket-client
42
+ name: event_emitter
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.1
47
+ version: 0.2.6
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.1
54
+ version: 0.2.6
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: google-protobuf
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 3.13.0
61
+ version: 3.21.7
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 3.13.0
68
+ version: 3.21.7
69
69
  - !ruby/object:Gem::Dependency
70
- name: event_emitter
70
+ name: google-style
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.6
76
- type: :runtime
75
+ version: 1.26.1
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.2.6
82
+ version: 1.26.1
83
83
  - !ruby/object:Gem::Dependency
84
- name: google-style
84
+ name: async
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.24.0
89
+ version: 1.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.24.0
96
+ version: 1.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: minitest
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '5.14'
103
+ version: 5.16.2
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '5.14'
110
+ version: 5.16.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: minitest-autotest
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '1.0'
117
+ version: 1.1.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '1.0'
124
+ version: 1.1.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: minitest-focus
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '1.1'
131
+ version: 1.3.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '1.1'
138
+ version: 1.3.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: minitest-rg
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '5.2'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '5.2'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: autotest-suffix
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.1'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.1'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rake-compiler
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '1.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '1.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: hashie
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: 5.0.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 5.0.0
181
195
  description: rookout is the Ruby SDK for the Rookout Debugging Platform
182
196
  email:
183
197
  - support@rookout.com
@@ -189,6 +203,7 @@ files:
189
203
  - LICENSE
190
204
  - bin/rookout
191
205
  - lib/rookout.rb
206
+ - lib/rookout/atfork.rb
192
207
  - lib/rookout/augs/actions/action.rb
193
208
  - lib/rookout/augs/actions/action_run_processor.rb
194
209
  - lib/rookout/augs/aug.rb
@@ -196,20 +211,27 @@ files:
196
211
  - lib/rookout/augs/aug_rate_limiter.rb
197
212
  - lib/rookout/augs/augs_manager.rb
198
213
  - lib/rookout/augs/conditions/condition.rb
214
+ - lib/rookout/augs/limits_manager.rb
199
215
  - lib/rookout/augs/locations/location.rb
216
+ - lib/rookout/augs/locations/location_exception_handler.rb
200
217
  - lib/rookout/augs/locations/location_file_line.rb
201
218
  - lib/rookout/com_ws/agent_com_ws.rb
202
219
  - lib/rookout/com_ws/backoff.rb
203
220
  - lib/rookout/com_ws/command_handler.rb
221
+ - lib/rookout/com_ws/envelope_wrapper.rb
204
222
  - lib/rookout/com_ws/git.rb
205
223
  - lib/rookout/com_ws/information.rb
206
224
  - lib/rookout/com_ws/output.rb
225
+ - lib/rookout/com_ws/pinger.rb
207
226
  - lib/rookout/com_ws/token_bucket.rb
227
+ - lib/rookout/com_ws/websocket_client.rb
228
+ - lib/rookout/commit.rb
208
229
  - lib/rookout/config.rb
209
230
  - lib/rookout/exceptions.rb
210
231
  - lib/rookout/interface.rb
211
232
  - lib/rookout/logger.rb
212
233
  - lib/rookout/processor/namespace_serializer.rb
234
+ - lib/rookout/processor/namespace_serializer2.rb
213
235
  - lib/rookout/processor/namespaces/container_namespace.rb
214
236
  - lib/rookout/processor/namespaces/frame_namespace.rb
215
237
  - lib/rookout/processor/namespaces/namespace.rb
@@ -235,12 +257,16 @@ files:
235
257
  - lib/rookout/protobuf/controller_info_pb.rb
236
258
  - lib/rookout/protobuf/envelope_pb.rb
237
259
  - lib/rookout/protobuf/messages_pb.rb
260
+ - lib/rookout/protobuf/variant2_pb.rb
238
261
  - lib/rookout/protobuf/variant_pb.rb
239
262
  - lib/rookout/rookout_singleton.rb
263
+ - lib/rookout/sanitizer.rb
240
264
  - lib/rookout/services/position.rb
241
265
  - lib/rookout/services/tracer.rb
266
+ - lib/rookout/start.rb
242
267
  - lib/rookout/trigger_services.rb
243
268
  - lib/rookout/user_warnings.rb
269
+ - lib/rookout/utils.rb
244
270
  - lib/rookout/version.rb
245
271
  homepage: https://rookout.com
246
272
  licenses:
@@ -262,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
288
  - !ruby/object:Gem::Version
263
289
  version: '0'
264
290
  requirements: []
265
- rubygems_version: 3.1.4
291
+ rubygems_version: 3.3.26
266
292
  signing_key:
267
293
  specification_version: 4
268
294
  summary: rookout is the Ruby SDK for the Rookout Debugging Platform