rookout 0.1.45 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rookout/augs/aug_factory.rb +4 -4
- data/lib/rookout/com_ws/agent_com_ws.rb +2 -2
- data/lib/rookout/com_ws/envelope_wrapper.rb +13 -6
- data/lib/rookout/commit.rb +1 -1
- data/lib/rookout/config.rb +0 -2
- data/lib/rookout/processor/namespace_serializer2.rb +26 -0
- data/lib/rookout/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d494bb4243258775f4a13936da2eb7da62b67e420480d7f2996adc58f88e4ef
|
4
|
+
data.tar.gz: 3952626f68706316502bb672dc194e4b8d2b1c6924a5ce170accfaecb9eb7bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7615d7f6acb9d2d10154b5c617d02c87fb3a64a31f0f751c0bd7ccb7abe27466cb2c3ef967daa19aea312f4b15f87054f5132a48028cc5786b88817c8aabe96f
|
7
|
+
data.tar.gz: e6b619c886f621ba0b3bf9e4965f61cad35a2111cf2b9946798b83931905c693da9ad9ecfbd20e166d14a145fb9760457dc6a6c0f216c82b6f5ea554152ad8d4
|
@@ -67,7 +67,7 @@ module Rookout
|
|
67
67
|
def create_limits_manager configuration
|
68
68
|
limiters = []
|
69
69
|
if global_rate_limiter.nil?
|
70
|
-
rate_limit = parse_rate_limit configuration["rateLimit"], configuration["rateLimitModifier"], 200, 5000
|
70
|
+
rate_limit = parse_rate_limit configuration["rateLimit"], configuration["rateLimitModifier"], 200, 5000
|
71
71
|
unless rate_limit.nil?
|
72
72
|
limiters.append AugRateLimiter.new(*rate_limit)
|
73
73
|
end
|
@@ -82,7 +82,7 @@ module Rookout
|
|
82
82
|
if @global_rate_limiter.nil? && Rookout::Config.global_rate_limit != ""
|
83
83
|
begin
|
84
84
|
rate_limit = parse_rate_limit Rookout::Config.global_rate_limit,
|
85
|
-
"0", 0, 0
|
85
|
+
"0", 0, 0
|
86
86
|
if rate_limit.nil?
|
87
87
|
raise Exceptions::RookInvalidRateLimitConfiguration, Rookout::Config.global_rate_limit
|
88
88
|
end
|
@@ -101,7 +101,7 @@ module Rookout
|
|
101
101
|
@global_rate_limiter
|
102
102
|
end
|
103
103
|
|
104
|
-
def parse_rate_limit config, modifier_config, default_quota, default_window
|
104
|
+
def parse_rate_limit config, modifier_config, default_quota, default_window
|
105
105
|
window_quota = default_quota
|
106
106
|
window_size = default_window
|
107
107
|
|
@@ -129,7 +129,7 @@ module Rookout
|
|
129
129
|
raise Exceptions::RookInvalidRateLimitConfiguration, config
|
130
130
|
end
|
131
131
|
|
132
|
-
[window_quota_ns
|
132
|
+
[window_quota_ns, window_size_ns, rate_limit_modifier]
|
133
133
|
end
|
134
134
|
end
|
135
135
|
end
|
@@ -114,8 +114,8 @@ module Rookout
|
|
114
114
|
|
115
115
|
if @print_on_initial_connection
|
116
116
|
@print_on_initial_connection = false
|
117
|
-
Utils.quiet_puts "[Rookout] Successfully connected to controller"
|
118
|
-
|
117
|
+
Utils.quiet_puts "[Rookout] Successfully connected to controller."
|
118
|
+
Logger.instance.debug "[Rookout] Agent ID is #{@agent_id}"
|
119
119
|
end
|
120
120
|
Logger.instance.debug "WebSocket connected successfully"
|
121
121
|
Logger.instance.info "Finished initialization"
|
@@ -29,19 +29,26 @@ class Variant2EnvelopeWrapper < EnvelopeWrapperBase
|
|
29
29
|
report_id: report_id
|
30
30
|
@serializer = Rookout::Processor::NamespaceSerializer2.new
|
31
31
|
@aug_report_message.arguments2 = @serializer.dump arguments, true
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
@envelope = wrap_in_envelope @aug_report_message
|
36
|
-
@aug_report_message = nil
|
32
|
+
|
33
|
+
@estimated_length = @serializer.estimated_pending_bytes
|
34
|
+
@envelope = nil
|
37
35
|
end
|
38
36
|
|
39
37
|
def envelope
|
38
|
+
if @envelope.nil?
|
39
|
+
@serializer.string_cache.each do |key, value|
|
40
|
+
@aug_report_message.strings_cache[key.encode "UTF-8", invalid: :replace, undef: :replace, replace: "?"] = value
|
41
|
+
end
|
42
|
+
@envelope = wrap_in_envelope @aug_report_message
|
43
|
+
|
44
|
+
@serializer = nil
|
45
|
+
@aug_report_message = nil
|
46
|
+
end
|
40
47
|
@envelope
|
41
48
|
end
|
42
49
|
|
43
50
|
def calculate_size
|
44
|
-
@
|
51
|
+
@estimated_length
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
data/lib/rookout/commit.rb
CHANGED
data/lib/rookout/config.rb
CHANGED
@@ -81,13 +81,11 @@ module Rookout
|
|
81
81
|
attr_accessor :global_rate_limit_quota
|
82
82
|
attr_accessor :global_rate_limit_window_size
|
83
83
|
attr_accessor :global_rate_limit
|
84
|
-
attr_accessor :global_rate_limit_multiplier
|
85
84
|
attr_accessor :using_global_rate_limiter
|
86
85
|
|
87
86
|
Rookout::Config.global_rate_limit_quota = ""
|
88
87
|
Rookout::Config.global_rate_limit_window_size = ""
|
89
88
|
Rookout::Config.global_rate_limit = ""
|
90
|
-
Rookout::Config.global_rate_limit_multiplier = 1
|
91
89
|
Rookout::Config.using_global_rate_limiter = false
|
92
90
|
|
93
91
|
def update_config configuration
|
@@ -44,10 +44,12 @@ module Rookout
|
|
44
44
|
|
45
45
|
def dump_variant_type variant, type
|
46
46
|
variant.variant_type_max_depth = type << 1
|
47
|
+
@estimated_pending_bytes += 2 # Field header + short number
|
47
48
|
end
|
48
49
|
|
49
50
|
def dump_variant_type_max_depth variant, type
|
50
51
|
variant.variant_type_max_depth = (type << 1) | 1
|
52
|
+
@estimated_pending_bytes += 2 # Field header + short number
|
51
53
|
end
|
52
54
|
|
53
55
|
def dump namespace, log_errors
|
@@ -64,6 +66,7 @@ module Rookout
|
|
64
66
|
rescue StandardError => e
|
65
67
|
message = "Failed to serialize namespace"
|
66
68
|
variant = Com::Rookout::Variant2.new
|
69
|
+
@estimated_pending_bytes = 0
|
67
70
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_ERROR
|
68
71
|
|
69
72
|
if log_errors
|
@@ -84,6 +87,7 @@ module Rookout
|
|
84
87
|
rescue StandardError => e
|
85
88
|
message = "Failed to serialize object"
|
86
89
|
variant = Com::Rookout::Variant2.new
|
90
|
+
@estimated_pending_bytes = 0
|
87
91
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_ERROR
|
88
92
|
|
89
93
|
if log_object_errors
|
@@ -145,20 +149,24 @@ module Rookout
|
|
145
149
|
when true
|
146
150
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
|
147
151
|
variant.long_value = 1
|
152
|
+
@estimated_pending_bytes += 2 # Header + short number
|
148
153
|
when false
|
149
154
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
|
150
155
|
variant.long_value = 0
|
156
|
+
@estimated_pending_bytes += 2 # Header + short number
|
151
157
|
when Integer
|
152
158
|
dump_integer obj, variant
|
153
159
|
when Float
|
154
160
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_DOUBLE
|
155
161
|
variant.double_value = obj.to_f
|
162
|
+
@estimated_pending_bytes += 7 # Header + 64 bit float
|
156
163
|
when BigDecimal
|
157
164
|
dump_string obj.to_s, variant, config # TODO: NS: This might cut the decimal value, is that ok?
|
158
165
|
when Complex
|
159
166
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_COMPLEX
|
160
167
|
variant.complex_value = Com::Rookout::Variant::Complex.new real: obj.real.to_f,
|
161
168
|
imaginary: obj.imaginary.to_f
|
169
|
+
@estimated_pending_bytes += 8 # Large header + size + (header + 64 bit float) * 2
|
162
170
|
else
|
163
171
|
raise Exceptions::RookClassCannotBeSerialized.new(obj.class, "Unknown Numeric Type")
|
164
172
|
end
|
@@ -173,6 +181,7 @@ module Rookout
|
|
173
181
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LARGE_INT
|
174
182
|
variant.bytes_index_in_cache = get_string_index_in_cache obj.to_s
|
175
183
|
end
|
184
|
+
@estimated_pending_bytes += 3 # Header + number
|
176
185
|
end
|
177
186
|
|
178
187
|
def dump_string obj, variant, config
|
@@ -186,16 +195,20 @@ module Rookout
|
|
186
195
|
variant.original_size = obj.length
|
187
196
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_STRING
|
188
197
|
variant.bytes_index_in_cache = get_string_index_in_cache final_obj
|
198
|
+
@estimated_pending_bytes += 6 # Header + number + header + number
|
189
199
|
end
|
190
200
|
|
191
201
|
def dump_time obj, variant
|
192
202
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_TIME
|
193
203
|
variant.time_value = Google::Protobuf::Timestamp.new
|
194
204
|
variant.time_value.from_time obj
|
205
|
+
|
206
|
+
@estimated_pending_bytes += 16 # Header + size + (header + 32 bit number + header + 64 bit number)
|
195
207
|
end
|
196
208
|
|
197
209
|
def dump_array obj, variant, current_depth, config, log_object_errors
|
198
210
|
variant.original_size = obj.length
|
211
|
+
@estimated_pending_bytes += 3 # Header + number
|
199
212
|
|
200
213
|
weighted_children_depth = current_depth + 1
|
201
214
|
if weighted_children_depth <= config.max_collection_depth
|
@@ -203,6 +216,7 @@ module Rookout
|
|
203
216
|
obj.each_with_index do |value, index|
|
204
217
|
break if index >= config.max_width
|
205
218
|
variant.collection_values << dump_raw_object(value, weighted_children_depth, config, log_object_errors)
|
219
|
+
@estimated_pending_bytes += 3 # Header + size
|
206
220
|
end
|
207
221
|
else
|
208
222
|
dump_variant_type_max_depth variant, Com::Rookout::Variant::Type::VARIANT_LIST
|
@@ -219,6 +233,7 @@ module Rookout
|
|
219
233
|
break if index >= config.max_width
|
220
234
|
variant.collection_keys << dump_raw_object(key, weighted_children_depth, config, log_object_errors)
|
221
235
|
variant.collection_values << dump_raw_object(value, weighted_children_depth, config, log_object_errors)
|
236
|
+
@estimated_pending_bytes += 6 # Header + size + header + size
|
222
237
|
end
|
223
238
|
else
|
224
239
|
dump_variant_type_max_depth variant, Com::Rookout::Variant::Type::VARIANT_MAP
|
@@ -229,12 +244,15 @@ module Rookout
|
|
229
244
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_OBJECT
|
230
245
|
variant.attribute_names_in_cache << get_string_index_in_cache("message")
|
231
246
|
variant.attribute_values << dump_raw_object(obj.message, current_depth + 1, config, log_object_errors)
|
247
|
+
@estimated_pending_bytes += 6 # Header + number + header + size
|
232
248
|
|
233
249
|
variant.attribute_names_in_cache << get_string_index_in_cache("cause")
|
234
250
|
variant.attribute_values << dump_raw_object(obj.cause, current_depth + 1, config, log_object_errors)
|
251
|
+
@estimated_pending_bytes += 6 # Header + number + header + size
|
235
252
|
|
236
253
|
variant.attribute_names_in_cache << get_string_index_in_cache("backtrace")
|
237
254
|
variant.attribute_values << dump_raw_object(obj.backtrace, current_depth + 1, config, log_object_errors)
|
255
|
+
@estimated_pending_bytes += 6 # Header + number + header + size
|
238
256
|
end
|
239
257
|
|
240
258
|
def dump_code_object obj, variant
|
@@ -255,6 +273,9 @@ module Rookout
|
|
255
273
|
variant.code_values << Com::Rookout::Variant::CodeObject.new(name: name,
|
256
274
|
filename: source_location[0],
|
257
275
|
lineno: source_location[1])
|
276
|
+
# NOTE: This size is probably less, in Python we use the optional fields of CodeObject and in Ruby we don't,
|
277
|
+
# but it is better to estimate more
|
278
|
+
@estimated_pending_bytes += 14 # Header + size + (header + number) * 4
|
258
279
|
end
|
259
280
|
|
260
281
|
def dump_user_class variant, obj, current_depth, config, log_object_errors
|
@@ -266,6 +287,7 @@ module Rookout
|
|
266
287
|
raw_value = obj.instance_variable_get name
|
267
288
|
variant.attribute_names_in_cache << get_string_index_in_cache(name.to_s)
|
268
289
|
variant.attribute_values << dump_raw_object(raw_value, weighted_children_depth, config, log_object_errors)
|
290
|
+
@estimated_pending_bytes += 6 # Header + number + header + number
|
269
291
|
end
|
270
292
|
else
|
271
293
|
dump_variant_type_max_depth variant, Com::Rookout::Variant::Type::VARIANT_OBJECT
|
@@ -281,6 +303,8 @@ module Rookout
|
|
281
303
|
variant.attribute_values << dump(value, log_errors)
|
282
304
|
end
|
283
305
|
|
306
|
+
@estimated_pending_bytes += 4 # One number (packed field), One header + length
|
307
|
+
|
284
308
|
variant
|
285
309
|
end
|
286
310
|
|
@@ -297,6 +321,8 @@ module Rookout
|
|
297
321
|
lineno: frame.source_location[1],
|
298
322
|
name: frame.eval("__method__").to_s
|
299
323
|
variant.code_values << code_object
|
324
|
+
# See dump_code_object
|
325
|
+
@estimated_pending_bytes += 14 # Header + size + (header + number) * 4
|
300
326
|
end
|
301
327
|
variant
|
302
328
|
end
|
data/lib/rookout/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liran Haimovitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: binding_of_caller
|