rookout 0.1.29 → 0.1.32

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
  SHA256:
3
- metadata.gz: 49682fe35cb88044623330221963d1796926bd4d43274e52c6f5d2b9798939da
4
- data.tar.gz: '08146067813084fe74e9c89b8cf4a242b2932a9c2c057144de1cf3a6893fa5a8'
3
+ metadata.gz: 6b18921aad157928102aa2f122bdea86a90ea12b785bbb141c1e91d5d7d812ef
4
+ data.tar.gz: ee630f67fc3c697312163d2ec543cbbf83deef49025095bff23494ed5c0c66da
5
5
  SHA512:
6
- metadata.gz: 02ca398a95c761881102ef4d1bf8e3dcc71b38ef65379651e2687dd583ea06bd5bd7fd7843745de1a4568055158cc10d021d9e510134d9d93d63c35578b09818
7
- data.tar.gz: 55f7755051f8d26c407f4b0076975c20782d49b5427a8b55b7dad5e96f576e03519964a967665dd750e551765fc510551739a1a82b2a7582a308044f5fbb2cfd
6
+ metadata.gz: f6fb66f9fe31e89dd375957cb7bebe704dfc45450b3a6d45d37554bdf29a3da5ce5ce1dc7c58486cb11e7a2777147bcd20097c54dba7e84fed3001c22bb110d2
7
+ data.tar.gz: 62854a17c91661e8365e80165485537cb0d84155325f9fd5121b65832de12e2c7033c4c0edc899a270a2264ac9f05f93cee4dd0d592dbd803667c4541870d5e3
@@ -29,8 +29,9 @@ module Rookout
29
29
  max_aug_time = configuration["maxAugTime"] || Config.instrumentation_max_aug_time
30
30
 
31
31
  condition_configuration = configuration["conditional"]
32
- raise Exceptions::RookAugInvalidKey.new("conditional", configuration) unless
33
- condition_configuration.nil? || condition_configuration.is_a?(String)
32
+ unless condition_configuration.nil? || condition_configuration.is_a?(String)
33
+ raise Exceptions::RookAugInvalidKey.new("conditional", configuration)
34
+ end
34
35
  condition = condition_configuration.nil? ? nil : Conditions::Condition.new(condition_configuration)
35
36
 
36
37
  rate_limit = create_rate_limit configuration
@@ -47,15 +48,17 @@ module Rookout
47
48
 
48
49
  def create_location configuration, aug
49
50
  name = configuration["name"]
50
- raise Exceptions::RookObjectNameMissing if name.nil?
51
+ raise Exceptions::RookObjectNameMissing, configuration if name.nil?
51
52
 
52
53
  case name
53
54
  when "file_line"
54
55
  return Locations::LocationFileLine.new configuration, @output, aug
55
56
  when "exception_handler"
56
57
  return Locations::LocationExceptionHandler.new configuration, @output, aug
58
+ when "log_handler"
59
+ raise Exceptions::RookUnsupportedLiveLogger
57
60
  else
58
- raise Exceptions::RookUnsupportedLocation if name != "file_line"
61
+ raise Exceptions::RookUnsupportedLocation, configuration if name != "file_line"
59
62
  end
60
63
  end
61
64
 
@@ -44,6 +44,7 @@ module Rookout
44
44
  @main_thread = nil
45
45
  @outgoing_thread = nil
46
46
  @pending_messages = Queue.new
47
+ @pending_messages_length = 0
47
48
 
48
49
  @running = false
49
50
  @ready_event = Concurrent::Event.new
@@ -52,18 +53,21 @@ module Rookout
52
53
  @print_on_initial_connection = print_on_connect
53
54
  end
54
55
 
55
- def add message
56
- buffer = wrap_in_envelope message
57
- if buffer.length > Config.agent_com_max_message_limit
58
- exc = Exceptions::RookMessageSizeExceeded.new buffer.length, Config.agent_com_max_message_limit
56
+ def add envelope_wrapper
57
+ msg_size = envelope_wrapper.calculate_size
58
+ if @pending_messages_length + msg_size > Config.agent_com_max_queue_messages_length ||
59
+ queue_full?
60
+ exc = Exceptions::RookMessageSizeExceeded.new msg_size, Config.agent_com_max_queue_messages_length
59
61
  warning = Processor::RookError.new exc
60
62
  UserWarnings.notify_warning warning
61
63
 
62
- Logger.instance.warning "Dropping message, size was #{buffer.length} which is over the message size limit"
64
+ Logger.instance.warning "Dropping message, size was #{msg_size}, pedning messages: #{@pending_messages_length}
65
+ which is over the message size limit #{Config.agent_com_max_queue_messages_length},
66
+ queue length: #{@pending_messages.length}"
63
67
  return
64
68
  end
65
69
 
66
- @pending_messages.push buffer if @pending_messages.length < Config.agent_com_max_queued_messages
70
+ @pending_messages.push envelope_wrapper
67
71
  end
68
72
 
69
73
  def queue_full?
@@ -128,7 +132,7 @@ module Rookout
128
132
  @ready_event.set
129
133
  end
130
134
 
131
- Logger.instance.info "Connection failed; reason = #{e.message}"
135
+ Logger.instance.warning "Connection failed; reason = #{e.message}"
132
136
  end
133
137
 
134
138
  backoff.after_disconnect
@@ -191,12 +195,15 @@ module Rookout
191
195
  def outgoing client, on_exit
192
196
  Pinger.new(client, Config.agent_com_ping_interval, Config.agent_com_ping_timeout).repeat do
193
197
  begin
194
- msg = @pending_messages.pop true
198
+ envelope_wrapper = @pending_messages.pop true
195
199
  rescue ThreadError
196
200
  sleep 0.25
197
201
  next
198
202
  end
199
203
 
204
+ msg = envelope_wrapper.envelope
205
+ @pending_messages_length -= envelope_wrapper.calculate_size
206
+
200
207
  if msg.is_a? ExitMessage
201
208
  break if msg.thread == Thread.current
202
209
  elsif msg.is_a? FlushMessage
@@ -5,10 +5,10 @@ module Rookout
5
5
  class CommandHandler
6
6
  def initialize agent_com, augs_manager
7
7
  agent_com.on "Com::Rookout::InitialAugsCommand" do |initial_augs|
8
+ Config.update_config initial_augs.sdk_configuration
8
9
  augs = initial_augs.augs.map { |aug_json| JSON.parse aug_json }
9
10
  augs_manager.initialize_augs augs
10
11
  end
11
-
12
12
  agent_com.on "Com::Rookout::AddAugCommand" do |command|
13
13
  augs_manager.add_aug JSON.parse(command.aug_json)
14
14
  end
@@ -0,0 +1,57 @@
1
+ require_relative "../protobuf/envelope_pb"
2
+ require_relative "../processor/namespace_serializer2"
3
+
4
+
5
+ class EnvelopeWrapperBase
6
+ def wrap_in_envelope message
7
+ any_message = Google::Protobuf::Any.pack message
8
+ timestamp = Google::Protobuf::Timestamp.new
9
+ timestamp.from_time Time.new
10
+ envelope = Com::Rookout::Envelope.new msg: any_message, timestamp: timestamp
11
+ serialized = Com::Rookout::Envelope.encode envelope
12
+ serialized
13
+ end
14
+
15
+ def envelope
16
+ raise NotImplementedError
17
+ end
18
+
19
+ def calculate_size
20
+ raise NotImplementedError
21
+ end
22
+ end
23
+
24
+ class Variant2EnvelopeWrapper < EnvelopeWrapperBase
25
+ def initialize agent_id, aug_id, report_id, arguments
26
+ @aug_report_message = Com::Rookout::AugReportMessage.new agent_id: agent_id,
27
+ aug_id: aug_id,
28
+ report_id: report_id
29
+ @serializer = Rookout::Processor::NamespaceSerializer2.new
30
+ @aug_report_message.arguments2 = @serializer.dump arguments
31
+ end
32
+
33
+ def envelope
34
+ return @envelope unless @envelope.nil?
35
+ @serializer.string_cache.each { |key, value| @aug_report_message.strings_cache[key] = value }
36
+ @envelope = wrap_in_envelope @aug_report_message
37
+ @aug_report_message = nil
38
+ end
39
+
40
+ def calculate_size
41
+ @envelope.length + @serializer.estimated_pending_bytes
42
+ end
43
+ end
44
+
45
+ class EnvelopeWrapper < EnvelopeWrapperBase
46
+ def initialize message
47
+ @envelope = wrap_in_envelope message
48
+ end
49
+
50
+ def envelope
51
+ @envelope
52
+ end
53
+
54
+ def calculate_size
55
+ @envelope.length
56
+ end
57
+ end
@@ -9,6 +9,7 @@ module Rookout
9
9
  require_relative "../processor/namespace_serializer"
10
10
 
11
11
  require_relative "token_bucket"
12
+ require_relative "envelope_wrapper"
12
13
 
13
14
  class Output
14
15
  def initialize
@@ -64,11 +65,13 @@ module Rookout
64
65
  status = Com::Rookout::RuleStatusMessage.new agent_id: @agent_id,
65
66
  rule_id: rule_id,
66
67
  active: active
68
+
69
+ envelope_wrapper = EnvelopeWrapper.new status
67
70
  if error
68
71
  status.error = error.dumps
69
72
  end
70
73
 
71
- @agent_com.add status
74
+ @agent_com.add envelope_wrapper
72
75
  end
73
76
  end
74
77
 
@@ -76,17 +79,22 @@ module Rookout
76
79
  return if @closing || !@agent_com
77
80
 
78
81
  @user_message_bucket.if_available do
79
- if arguments.nil? || arguments.call_method("size", "") == 0
80
- protobuf_arguments = nil
82
+ if Config.protobuf_version2
83
+ envelope_wrapper = Variant2EnvelopeWrapper.new @agent_id, aug_id, report_id, arguments
81
84
  else
82
- protobuf_arguments = Processor::NamespaceSerializer.dump arguments
85
+ if arguments.nil? || arguments.call_method("size", "") == 0
86
+ protobuf_arguments = nil
87
+ else
88
+ protobuf_arguments = Processor::NamespaceSerializer.dump arguments
89
+ end
90
+
91
+ envelope_wrapper = EnvelopeWrapper.new(Com::Rookout::AugReportMessage.new(agent_id: @agent_id,
92
+ aug_id: aug_id,
93
+ report_id: report_id,
94
+ arguments: protobuf_arguments))
83
95
  end
84
96
 
85
- msg = Com::Rookout::AugReportMessage.new agent_id: @agent_id,
86
- aug_id: aug_id,
87
- report_id: report_id,
88
- arguments: protobuf_arguments
89
- @agent_com.add msg
97
+ @agent_com.add envelope_wrapper
90
98
  end
91
99
  end
92
100
 
@@ -126,7 +134,10 @@ module Rookout
126
134
  text: text,
127
135
  formatted_message: formatted_message,
128
136
  legacy_arguments: protobuf_arguments
129
- @agent_com.add msg
137
+
138
+ envelope_wrapper = EnvelopeWrapper.new msg
139
+
140
+ @agent_com.add envelope_wrapper
130
141
  end
131
142
  end
132
143
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "7d24d368fe1a95d7c6b7e51a2f4ea2e143792b97".freeze
2
+ COMMIT = "2073fbdf0e452e584bc3ec82d0e9026a9b991c43".freeze
3
3
  end
@@ -15,12 +15,14 @@ module Rookout
15
15
 
16
16
  attr_accessor :agent_com_configuration_command_thread_name,
17
17
  :agent_com_max_message_limit,
18
+ :agent_com_max_queue_messages_length,
18
19
  :agent_com_timeout,
19
20
  :agent_com_ping_interval,
20
21
  :agent_com_ping_timeout,
21
22
  :agent_com_flush_timeout,
22
23
  :agent_com_max_queued_messages
23
24
  Rookout::Config.agent_com_max_message_limit = 1024 * 1024
25
+ Rookout::Config.agent_com_max_queue_messages_length = 15 * 1024 * 1024
24
26
  Rookout::Config.agent_com_timeout = 3
25
27
  Rookout::Config.agent_com_ping_interval = 10
26
28
  Rookout::Config.agent_com_ping_timeout = 30
@@ -51,6 +53,24 @@ module Rookout
51
53
  attr_accessor :rookout_version, :rookout_commit
52
54
  Rookout::Config.rookout_version = Rookout::VERSION
53
55
  Rookout::Config.rookout_commit = Rookout::COMMIT
56
+
57
+ attr_accessor :protobuf_version2
58
+ Rookout::Config.protobuf_version2 = false
59
+
60
+ attr_accessor :true_values
61
+ Rookout::Config.true_values = ["y", "Y", "yes", "Yes", "YES", "true", "True", "TRUE", "1"]
62
+
63
+
64
+ def update_config configuration
65
+ is_config_proto2 = configuration["RUBY_PROTOBUF_VERSION_2"]
66
+ return if is_config_proto2.nil?
67
+ is_env_proto2 = ENV[env_var_name]
68
+ if is_env_proto2.nil?
69
+ @protobuf_version2 = true if @true_values.includes? is_config_proto2
70
+ elsif @true_values.includes? is_env_proto2
71
+ @protobuf_version2 = true
72
+ end
73
+ end
54
74
  end
55
75
  end
56
76
  end
@@ -219,5 +219,11 @@ module Rookout
219
219
  }
220
220
  end
221
221
  end
222
+
223
+ class RookUnsupportedLiveLogger < ToolException
224
+ def initialize
225
+ super "Live Logger is not supported. Try using Rookout Live Debugger instead."
226
+ end
227
+ end
222
228
  end
223
229
  end
@@ -43,7 +43,7 @@ module Rookout
43
43
  STDERR.puts "[Rookout] Failed to start Rookout: #{e.message}"
44
44
  rescue RookCommunicationException => e
45
45
  raise if throw_errors
46
- STDERR.puts "[Rookout] " + e.message
46
+ Logger.instance.warning "[Rookout] " + e.message
47
47
  rescue Exception => e
48
48
  STDERR.puts e.full_message if Config.debug
49
49
  raise if throw_errors
@@ -0,0 +1,283 @@
1
+ module Rookout
2
+ module Processor
3
+ class NamespaceSerializer2
4
+ require_relative "../logger"
5
+
6
+ require_relative "../protobuf/variant_pb"
7
+ require_relative "../protobuf/variant2_pb"
8
+ require_relative "../user_warnings"
9
+ require_relative "./namespaces/container_namespace"
10
+ require_relative "./namespaces/traceback_namespace"
11
+
12
+ def initialize
13
+ @string_cache = {}
14
+ @estimated_pending_bytes = 0
15
+ end
16
+
17
+ attr_reader :string_cache, :estimated_pending_bytes
18
+
19
+ def get_string_index_in_cache str
20
+ if @string_cache.key? str
21
+ @string_cache[str]
22
+ else
23
+ @estimated_pending_bytes += str.length + 5
24
+ current_size = @string_cache.size
25
+ @string_cache.store str, current_size
26
+ current_size
27
+ end
28
+ end
29
+
30
+ def dump_variant_type variant, type
31
+ variant.variant_type_max_depth = type << 1
32
+ end
33
+
34
+ def dump_variant_type_max_depth variant, type
35
+ variant.variant_type_max_depth = (type << 1) | 1
36
+ end
37
+
38
+ def dump namespace, log_errors = true
39
+ if namespace.is_a? Namespaces::RubyObjectNamespace
40
+ dump_ruby_object_namespace namespace, log_errors
41
+ elsif namespace.is_a? Namespaces::ContainerNamespace
42
+ dump_container_namespace namespace, log_errors
43
+ elsif namespace.is_a? Namespaces::TracebackNamespace
44
+ dump_traceback_namespace namespace
45
+ end
46
+ rescue StandardError => e
47
+ message = "Failed to serialize namespace"
48
+ variant = Com::Rookout::Variant2.new
49
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_ERROR
50
+
51
+ if log_errors
52
+ Logger.instance.exception message, e
53
+
54
+ error = RookError.new e, message
55
+ UserWarnings.notify_warning error
56
+ end
57
+ variant
58
+ end
59
+
60
+ def dump_ruby_object_namespace namespace, log_errors
61
+ dump_raw_object namespace.obj, 0, namespace.dump_config, log_errors
62
+ end
63
+
64
+ def dump_raw_object obj, current_depth, config, log_object_errors
65
+ unsafe_dump_object obj, current_depth, config, log_object_errors
66
+ rescue StandardError => e
67
+ message = "Failed to serialize object"
68
+ variant = Com::Rookout::Variant2.new
69
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_ERROR
70
+
71
+ if log_object_errors
72
+ Logger.instance.exception message, e
73
+
74
+ error = RookError.new e, message
75
+ UserWarnings.notify_warning error
76
+ end
77
+ variant
78
+ end
79
+
80
+ # rubocop:disable Metrics/AbcSize
81
+ # rubocop:disable Metrics/PerceivedComplexity
82
+ # rubocop:disable Metrics/CyclomaticComplexity
83
+ def unsafe_dump_object obj, current_depth, config, log_object_errors
84
+ variant = Com::Rookout::Variant2.new original_type_index_in_cache: get_string_index_in_cache(obj.class.to_s)
85
+
86
+ if obj.nil?
87
+ dump_nil variant
88
+ elsif obj.is_a?(Numeric) || obj.is_a?(TrueClass) || obj.is_a?(FalseClass)
89
+ dump_numeric obj, variant, config
90
+ elsif obj.is_a?(String) || obj.is_a?(Symbol)
91
+ dump_string obj, variant, config
92
+ elsif obj.is_a? Time
93
+ dump_time obj, variant
94
+ elsif obj.class == Array
95
+ dump_array obj, variant, current_depth, config, log_object_errors
96
+ elsif obj.class == Hash
97
+ dump_hash obj, variant, current_depth, config, log_object_errors
98
+ elsif obj.is_a? Exception
99
+ dump_exception obj, variant, current_depth, config, log_object_errors
100
+ elsif obj.is_a?(Method) || obj.is_a?(Proc) || obj.is_a?(Class) || obj.is_a?(Module)
101
+ dump_code_object obj, variant
102
+ else
103
+ dump_user_class variant, obj, current_depth, config, log_object_errors
104
+ end
105
+
106
+ variant
107
+ end
108
+ # rubocop:enable Metrics/AbcSize
109
+ # rubocop:enable Metrics/PerceivedComplexity
110
+ # rubocop:enable Metrics/CyclomaticComplexity
111
+
112
+ def dump_nil variant
113
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_NONE
114
+ end
115
+
116
+ # Based off protobuf for Python
117
+ INT32_MIN = -2147483648
118
+ INT32_MAX = 2147483647
119
+ INT64_MIN = -(1 << 63)
120
+ INT64_MAX = (1 << 63) - 1
121
+
122
+ def dump_numeric obj, variant, config
123
+ if obj == true
124
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
125
+ variant.long_value = 1
126
+ elsif obj == false
127
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
128
+ variant.long_value = 0
129
+ elsif obj.is_a? Integer
130
+ dump_integer obj, variant
131
+ elsif obj.is_a? Float
132
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_DOUBLE
133
+ variant.double_value = obj.to_f
134
+ elsif obj.is_a? BigDecimal
135
+ dump_string obj.to_s, variant, config # TODO: NS: This might cut the decimal value, is that ok?
136
+ elsif obj.is_a? Complex
137
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_COMPLEX
138
+ variant.complex_value = Com::Rookout::Variant::Complex.new real: obj.real.to_f,
139
+ imaginary: obj.imaginary.to_f
140
+ else
141
+ raise Exceptions::RookClassCannotBeSerialized.new(obj.class, "Unknown Numeric Type")
142
+ end
143
+ # TODO: ADD SUPPORT FOR RATIONALS
144
+ end
145
+
146
+ def dump_integer obj, variant
147
+ if obj > INT32_MIN && obj < INT64_MAX
148
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
149
+ variant.long_value = obj
150
+ else
151
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LARGE_INT
152
+ variant.bytes_index_in_cache = get_string_index_in_cache obj.to_s
153
+ end
154
+ end
155
+
156
+ def dump_string obj, variant, config
157
+ obj = obj.to_s
158
+ if obj.length > config.max_string
159
+ final_obj = obj[0...config.max_string]
160
+ else
161
+ final_obj = obj
162
+ end
163
+
164
+ variant.original_size = obj.length
165
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_STRING
166
+ variant.bytes_index_in_cache = get_string_index_in_cache final_obj
167
+ end
168
+
169
+ def dump_time obj, variant
170
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_TIME
171
+ variant.time_value = Google::Protobuf::Timestamp.new
172
+ variant.time_value.from_time obj
173
+ end
174
+
175
+ def dump_array obj, variant, current_depth, config, log_object_errors
176
+ variant.original_size = obj.length
177
+
178
+ weighted_children_depth = current_depth + 1
179
+ if weighted_children_depth <= config.max_collection_depth
180
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LIST
181
+ obj.each_with_index do |value, index|
182
+ break if index >= config.max_width
183
+ variant.collection_values << dump_raw_object(value, weighted_children_depth, config, log_object_errors)
184
+ end
185
+ else
186
+ dump_variant_type_max_depth variant, Com::Rookout::Variant::Type::VARIANT_LIST
187
+ end
188
+ end
189
+
190
+ def dump_hash obj, variant, current_depth, config, log_object_errors
191
+ variant.original_size = obj.length
192
+
193
+ weighted_children_depth = current_depth + 1
194
+ if current_depth <= config.max_collection_depth
195
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_MAP
196
+ obj.each_with_index do |(key, value), index|
197
+ break if index >= config.max_width
198
+ variant.collection_keys << dump_raw_object(key, weighted_children_depth, config, log_object_errors)
199
+ variant.collection_values << dump_raw_object(value, weighted_children_depth, config, log_object_errors)
200
+ end
201
+ else
202
+ dump_variant_type_max_depth variant, Com::Rookout::Variant::Type::VARIANT_MAP
203
+ end
204
+ end
205
+
206
+ def dump_exception obj, variant, current_depth, config, log_object_errors
207
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_OBJECT
208
+ variant.attribute_names_in_cache << get_string_index_in_cache("message")
209
+ variant.attribute_values << dump_raw_object(obj.message, current_depth + 1, config, log_object_errors)
210
+
211
+ variant.attribute_names_in_cache << get_string_index_in_cache("cause")
212
+ variant.attribute_values << dump_raw_object(obj.cause, current_depth + 1, config, log_object_errors)
213
+
214
+ variant.attribute_names_in_cache << get_string_index_in_cache("backtrace")
215
+ variant.attribute_values << dump_raw_object(obj.backtrace, current_depth + 1, config, log_object_errors)
216
+ end
217
+
218
+ def dump_code_object obj, variant
219
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_CODE_OBJECT
220
+
221
+ if obj.is_a?(Proc) || obj.is_a?(Method)
222
+ source_location = obj.source_location
223
+ else
224
+ source_location = [nil, nil]
225
+ end
226
+
227
+ if obj.is_a? Proc
228
+ name = ""
229
+ else
230
+ name = obj.name
231
+ end
232
+
233
+ variant.code_values << Com::Rookout::Variant::CodeObject.new(name: name,
234
+ filename: source_location[0],
235
+ lineno: source_location[1])
236
+ end
237
+
238
+ def dump_user_class variant, obj, current_depth, config, log_object_errors
239
+ weighted_children_depth = current_depth + 1
240
+ if weighted_children_depth <= config.max_collection_depth
241
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_OBJECT
242
+
243
+ obj.instance_variables.each do |name|
244
+ raw_value = obj.instance_variable_get name
245
+ variant.attribute_names_in_cache << get_string_index_in_cache(name.to_s)
246
+ variant.attribute_values << dump_raw_object(raw_value, weighted_children_depth, config, log_object_errors)
247
+ end
248
+ else
249
+ dump_variant_type_max_depth variant, Com::Rookout::Variant::Type::VARIANT_OBJECT
250
+ end
251
+ end
252
+
253
+ def dump_container_namespace namespace, log_errors
254
+ variant = Com::Rookout::Variant2.new
255
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_NAMESPACE
256
+
257
+ namespace.hash.each do |key, value|
258
+ variant.attribute_names_in_cache << get_string_index_in_cache(key.to_s)
259
+ variant.attribute_values << dump(value, log_errors)
260
+ end
261
+
262
+ variant
263
+ end
264
+
265
+ def dump_traceback_namespace namespace
266
+ variant = Com::Rookout::Variant2.new
267
+ dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_TRACEBACK
268
+
269
+ namespace.depth.times do |i|
270
+ position = i + namespace.offset
271
+ break if position >= namespace.backtrace.length
272
+ frame = namespace.backtrace[position]
273
+
274
+ code_object = Com::Rookout::Variant::CodeObject.new filename: frame.source_location[0],
275
+ lineno: frame.source_location[1],
276
+ name: frame.eval("__method__").to_s
277
+ variant.code_values << code_object
278
+ end
279
+ variant
280
+ end
281
+ end
282
+ end
283
+ end
@@ -8,11 +8,15 @@ module Rookout
8
8
 
9
9
  require_relative "../../protobuf/variant_pb"
10
10
 
11
+
11
12
  class ContainerNamespace < Namespace
12
13
  def initialize hash = {}
13
14
  @hash = hash
14
15
  end
15
16
 
17
+ attr_reader :hash
18
+
19
+
16
20
  def call_method name, args
17
21
  return RubyObjectNamespace.new @hash.length if name == "size"
18
22
  super
@@ -20,12 +20,12 @@ module Rookout
20
20
  attr_reader :max_depth, :max_width, :max_collection_depth, :max_string
21
21
  end
22
22
 
23
- OBJECT_DUMP_CONFIG_STRICT = ObjectDumpConfig.new 2, 10, 1, 128
24
- OBJECT_DUMP_CONFIG_DEFAULT = ObjectDumpConfig.new 4, 20, 2, 512
25
- OBJECT_DUMP_CONFIG_TOLERANT = ObjectDumpConfig.new 5, 50, 4, 4 * 1024
23
+ OBJECT_DUMP_CONFIG_STRICT = ObjectDumpConfig.new 2, 10, 2, 128
24
+ OBJECT_DUMP_CONFIG_DEFAULT = ObjectDumpConfig.new 4, 15, 4, 512
25
+ OBJECT_DUMP_CONFIG_TOLERANT = ObjectDumpConfig.new 5, 20, 5, 4 * 1024
26
26
 
27
27
  OBJECT_DUMP_CONFIG_STRING = ObjectDumpConfig.new 1, 0, 0, 64 * 1024
28
- OBJECT_DUMP_CONFIG_COLLECTION = ObjectDumpConfig.new 4, 100, 2, 512
28
+ OBJECT_DUMP_CONFIG_COLLECTION = ObjectDumpConfig.new 4, 100, 4, 512
29
29
 
30
30
  OBJECT_DUMP_TABLE = {
31
31
  "" => OBJECT_DUMP_CONFIG_DEFAULT,
@@ -47,7 +47,7 @@ module Rookout
47
47
  def tailor_limits!
48
48
  if @obj.is_a? String
49
49
  @dump_config = OBJECT_DUMP_CONFIG_STRING
50
- elsif @obj.is_a?(Hash) || @obj.is_a?(Array)
50
+ elsif (@obj.is_a?(Hash) || @obj.is_a?(Array)) && @obj.length > OBJECT_DUMP_CONFIG_TOLERANT.max_width
51
51
  @dump_config = OBJECT_DUMP_CONFIG_COLLECTION
52
52
  else
53
53
  @dump_config = OBJECT_DUMP_CONFIG_TOLERANT
@@ -13,6 +13,8 @@ module Rookout
13
13
  @depth = depth
14
14
  end
15
15
 
16
+ attr_reader :backtrace, :offset, :depth
17
+
16
18
  def read_key key
17
19
  FrameNamespace.new @backtrace[key + @offset]
18
20
  end
@@ -33,7 +33,7 @@ module Rookout
33
33
  def read_from namespace
34
34
  begin
35
35
  result = Maps.parse @path, actions: Canopy::Actions.new(namespace)
36
- rescue Maps::ParseError => e
36
+ rescue Maps::ParseError, NameError => e
37
37
  raise RookInvalidArithmeticPath.new(@path, e)
38
38
  end
39
39
 
@@ -18,6 +18,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
18
18
  optional :platform_release, :string, 10
19
19
  optional :platform_version, :string, 11
20
20
  optional :platform_string, :string, 12
21
+ optional :parent_controller_id, :string, 13
21
22
  end
22
23
  end
23
24
  end
@@ -4,6 +4,7 @@
4
4
  require 'google/protobuf'
5
5
 
6
6
  require_relative 'variant_pb'
7
+ require_relative 'variant2_pb'
7
8
  require_relative 'agent_info_pb'
8
9
  require_relative 'controller_info_pb'
9
10
  require 'google/protobuf/any_pb'
@@ -87,6 +88,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
87
88
  optional :aug_id, :string, 2
88
89
  optional :arguments, :message, 3, "com.rookout.Variant"
89
90
  optional :report_id, :string, 4
91
+ map :strings_cache, :string, :uint32, 5
92
+ repeated :buffer_cache_buffers, :bytes, 6
93
+ repeated :buffer_cache_indexes, :uint32, 7
94
+ optional :arguments2, :message, 8, "com.rookout.Variant2"
95
+ optional :reverse_list_order, :bool, 9
90
96
  end
91
97
  add_message "com.rookout.UserMsg" do
92
98
  optional :aug_report, :message, 1, "com.rookout.AugReportMessage"
@@ -98,6 +104,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
98
104
  end
99
105
  add_message "com.rookout.InitialAugsCommand" do
100
106
  repeated :augs, :string, 1
107
+ map :sdk_configuration, :string, :string, 2
101
108
  end
102
109
  add_message "com.rookout.RemoveAugCommand" do
103
110
  optional :aug_id, :string, 1
@@ -117,6 +124,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
117
124
  repeated :connectedAgents, :string, 2
118
125
  end
119
126
  add_message "com.rookout.DataOnPremTokenRequest" do
127
+ optional :access_type, :enum, 1, "com.rookout.DataOnPremTokenAccessType"
120
128
  end
121
129
  add_message "com.rookout.DataOnPremTokenResponse" do
122
130
  optional :token, :bytes, 1
@@ -150,6 +158,44 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
150
158
  optional :message, :message, 2, "google.protobuf.Any"
151
159
  optional :error, :string, 3
152
160
  end
161
+ add_message "com.rookout.StartDatastoreConnectivityTestCommand" do
162
+ optional :orgId, :string, 1
163
+ optional :controllerId, :string, 2
164
+ optional :datastoreUrl, :string, 3
165
+ optional :workspaceId, :string, 4
166
+ end
167
+ add_message "com.rookout.DatastoreConnectivityTestC2cResponse" do
168
+ optional :controllerId, :string, 1
169
+ optional :TestMessageId, :string, 2
170
+ optional :isSuccess, :bool, 3
171
+ optional :errorString, :string, 4
172
+ end
173
+ add_message "com.rookout.PingDatastoreCommand" do
174
+ optional :datastoreUrl, :string, 1
175
+ end
176
+ add_message "com.rookout.DatastoreInformation" do
177
+ optional :version, :string, 1
178
+ optional :hostname, :string, 2
179
+ optional :machine_type, :string, 3
180
+ optional :network, :string, 4
181
+ optional :ip, :string, 5
182
+ optional :os, :string, 6
183
+ optional :os_release, :string, 7
184
+ optional :os_version, :string, 8
185
+ optional :os_string, :string, 9
186
+ end
187
+ add_message "com.rookout.OrgLanguagesConfigsRequest" do
188
+ end
189
+ add_message "com.rookout.LanguageConfig" do
190
+ map :config, :string, :string, 1
191
+ end
192
+ add_message "com.rookout.OrgLanguagesConfigsResponse" do
193
+ map :OrgConfig, :string, :message, 1, "com.rookout.LanguageConfig"
194
+ end
195
+ add_enum "com.rookout.DataOnPremTokenAccessType" do
196
+ value :WRITE, 0
197
+ value :READ, 1
198
+ end
153
199
  end
154
200
  end
155
201
 
@@ -185,5 +231,13 @@ module Com
185
231
  HitCountUpdateMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.HitCountUpdateMessage").msgclass
186
232
  C2cRpcRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.C2cRpcRequest").msgclass
187
233
  C2cRpcResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.C2cRpcResponse").msgclass
234
+ StartDatastoreConnectivityTestCommand = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.StartDatastoreConnectivityTestCommand").msgclass
235
+ DatastoreConnectivityTestC2cResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.DatastoreConnectivityTestC2cResponse").msgclass
236
+ PingDatastoreCommand = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.PingDatastoreCommand").msgclass
237
+ DatastoreInformation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.DatastoreInformation").msgclass
238
+ OrgLanguagesConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.OrgLanguagesConfigsRequest").msgclass
239
+ LanguageConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.LanguageConfig").msgclass
240
+ OrgLanguagesConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.OrgLanguagesConfigsResponse").msgclass
241
+ DataOnPremTokenAccessType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.DataOnPremTokenAccessType").enummodule
188
242
  end
189
243
  end
@@ -0,0 +1,42 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: variant2.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/timestamp_pb'
7
+ require_relative 'variant_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_file("variant2.proto", :syntax => :proto3) do
10
+ add_message "com.rookout.Error2" do
11
+ optional :message, :string, 1
12
+ optional :type, :string, 2
13
+ optional :parameters, :message, 3, "com.rookout.Variant2"
14
+ optional :exc, :message, 4, "com.rookout.Variant2"
15
+ optional :traceback, :message, 5, "com.rookout.Variant2"
16
+ end
17
+ add_message "com.rookout.Variant2" do
18
+ optional :variant_type_max_depth, :uint32, 1
19
+ optional :original_type_index_in_cache, :uint32, 2
20
+ repeated :attribute_names_in_cache, :uint32, 3
21
+ repeated :attribute_values, :message, 4, "com.rookout.Variant2"
22
+ optional :original_size, :uint32, 5
23
+ optional :long_value, :int64, 6
24
+ optional :bytes_index_in_cache, :uint32, 7
25
+ repeated :collection_keys, :message, 8, "com.rookout.Variant2"
26
+ repeated :collection_values, :message, 9, "com.rookout.Variant2"
27
+ optional :double_value, :double, 10
28
+ repeated :code_values, :message, 11, "com.rookout.Variant.CodeObject"
29
+ optional :time_value, :message, 12, "google.protobuf.Timestamp"
30
+ optional :error_value, :message, 16, "com.rookout.Error2"
31
+ optional :complex_value, :message, 17, "com.rookout.Variant.Complex"
32
+ optional :livetail, :message, 18, "com.rookout.Variant.LiveTailMessage"
33
+ end
34
+ end
35
+ end
36
+
37
+ module Com
38
+ module Rookout
39
+ Error2 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Error2").msgclass
40
+ Variant2 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Variant2").msgclass
41
+ end
42
+ end
@@ -18,6 +18,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
18
18
  optional :original_type, :string, 2
19
19
  repeated :attributes, :message, 3, "com.rookout.Variant.NamedValue"
20
20
  optional :max_depth, :bool, 4
21
+ optional :original_type_index_in_cache, :uint32, 5
21
22
  oneof :value do
22
23
  optional :int_value, :int32, 11
23
24
  optional :long_value, :int64, 12
@@ -35,6 +36,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
35
36
  optional :complex_value, :message, 28, "com.rookout.Variant.Complex"
36
37
  optional :enum_value, :message, 31, "com.rookout.Variant.Enumeration"
37
38
  optional :traceback, :message, 32, "com.rookout.Variant.Traceback"
39
+ optional :livetail, :message, 33, "com.rookout.Variant.LiveTailMessage"
38
40
  end
39
41
  end
40
42
  add_message "com.rookout.Variant.NamedValue" do
@@ -48,6 +50,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
48
50
  add_message "com.rookout.Variant.String" do
49
51
  optional :original_size, :int32, 1
50
52
  optional :value, :string, 2
53
+ optional :value_index_in_cache, :uint32, 3
51
54
  end
52
55
  add_message "com.rookout.Variant.List" do
53
56
  optional :type, :string, 1
@@ -73,6 +76,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
73
76
  optional :module, :string, 2
74
77
  optional :filename, :string, 3
75
78
  optional :lineno, :uint32, 4
79
+ optional :name_index_in_cache, :uint32, 5
80
+ optional :module_index_in_cache, :uint32, 6
81
+ optional :filename_index_in_cache, :uint32, 7
76
82
  end
77
83
  add_message "com.rookout.Variant.LargeInt" do
78
84
  optional :value, :string, 1
@@ -89,6 +95,19 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
89
95
  add_message "com.rookout.Variant.Traceback" do
90
96
  repeated :locations, :message, 1, "com.rookout.Variant.CodeObject"
91
97
  end
98
+ add_message "com.rookout.Variant.LiveTailMessage" do
99
+ optional :level_name, :string, 1
100
+ optional :msg, :string, 2
101
+ optional :formatted_message, :string, 3
102
+ optional :time, :double, 4
103
+ optional :filename, :string, 5
104
+ optional :lineno, :int32, 6
105
+ optional :function, :string, 7
106
+ optional :module, :string, 8
107
+ optional :thread_id, :int64, 9
108
+ optional :thread_name, :string, 10
109
+ map :log_context, :string, :string, 11
110
+ end
92
111
  add_enum "com.rookout.Variant.Type" do
93
112
  value :VARIANT_NONE, 0
94
113
  value :VARIANT_INT, 1
@@ -113,6 +132,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
113
132
  value :VARIANT_DYNAMIC, 20
114
133
  value :VARIANT_ENUM, 21
115
134
  value :VARIANT_TRACEBACK, 22
135
+ value :VARIANT_LIVETAIL, 23
136
+ value :VARIANT_SET, 24
116
137
  end
117
138
  end
118
139
  end
@@ -134,6 +155,7 @@ module Com
134
155
  Variant::Complex = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Variant.Complex").msgclass
135
156
  Variant::Enumeration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Variant.Enumeration").msgclass
136
157
  Variant::Traceback = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Variant.Traceback").msgclass
158
+ Variant::LiveTailMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Variant.LiveTailMessage").msgclass
137
159
  Variant::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("com.rookout.Variant.Type").enummodule
138
160
  end
139
161
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.29".freeze
2
+ VERSION = "0.1.32".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.29
4
+ version: 0.1.32
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-01-17 00:00:00.000000000 Z
11
+ date: 2022-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 3.17.3
75
+ version: 3.19.2
76
76
  type: :runtime
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: 3.17.3
82
+ version: 3.19.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: google-style
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -203,6 +203,7 @@ files:
203
203
  - lib/rookout/com_ws/agent_com_ws.rb
204
204
  - lib/rookout/com_ws/backoff.rb
205
205
  - lib/rookout/com_ws/command_handler.rb
206
+ - lib/rookout/com_ws/envelope_wrapper.rb
206
207
  - lib/rookout/com_ws/git.rb
207
208
  - lib/rookout/com_ws/information.rb
208
209
  - lib/rookout/com_ws/output.rb
@@ -215,6 +216,7 @@ files:
215
216
  - lib/rookout/interface.rb
216
217
  - lib/rookout/logger.rb
217
218
  - lib/rookout/processor/namespace_serializer.rb
219
+ - lib/rookout/processor/namespace_serializer2.rb
218
220
  - lib/rookout/processor/namespaces/container_namespace.rb
219
221
  - lib/rookout/processor/namespaces/frame_namespace.rb
220
222
  - lib/rookout/processor/namespaces/namespace.rb
@@ -240,6 +242,7 @@ files:
240
242
  - lib/rookout/protobuf/controller_info_pb.rb
241
243
  - lib/rookout/protobuf/envelope_pb.rb
242
244
  - lib/rookout/protobuf/messages_pb.rb
245
+ - lib/rookout/protobuf/variant2_pb.rb
243
246
  - lib/rookout/protobuf/variant_pb.rb
244
247
  - lib/rookout/rookout_singleton.rb
245
248
  - lib/rookout/services/position.rb