rookout 0.1.42 → 0.1.44

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: 1b7b251222795c20881099bbd6f64cb0e9c66c24f837403aecc29d5fc8737d22
4
- data.tar.gz: 488333717b7f9a0ef507d5a621caa4a37a99bd87a3f966e63808ba773aeb83ef
3
+ metadata.gz: 0233712f50c0fe5e94c8288b73ee96a07da9bb1692cc553ac83692a10655c131
4
+ data.tar.gz: b273a8cc02ed25508400b58758c5706f6073a979c7d323316c9957dd4f186d30
5
5
  SHA512:
6
- metadata.gz: fc9945c4fad24e0ebdee3bb83a1f71d353cef33bd14f9881007324ad2e82aba3292ba63cf54e54c14922547b1b68f6da58a1cdff99426dfd2a9bb85da78516cc
7
- data.tar.gz: 1848074ffaa23f2632457e42dec7c04f4527cb4cad80af234e9bc7dc3c7c72f63c786ee7dfcae3e1e3bff44eb8665fcfabf5be7dcde2ead58eb3234d72909796
6
+ metadata.gz: afbacca6a3828ebb0e2bda728c072a9515fa6f3003945a9ab5bf972bde564a77dc950224d14bbc58b90aebdef3f505c90b89baf8d916beaca9c3bac3215fdb98
7
+ data.tar.gz: bf5c468000ed3dd7e2def2d628acab6540226ade8364a77036a12421ade338ed0106123f4c19cbc9e81c988e624bf50e9e84aa3dec090a17e68c41014390dc06
@@ -107,7 +107,9 @@ module Rookout
107
107
 
108
108
  unless config.nil? || config.empty?
109
109
  rate_limit_split = config.split "/"
110
- unless rate_limit_split.length == 2 && rate_limit_split[0].is_number? && rate_limit_split[1].is_number?
110
+ unless rate_limit_split.length == 2 && \
111
+ Utils.is_number?(rate_limit_split[0]) && \
112
+ Utils.is_number?(rate_limit_split[1])
111
113
  raise Exceptions::RookInvalidRateLimitConfiguration, config
112
114
  end
113
115
 
@@ -53,7 +53,7 @@ module Rookout
53
53
  def notify_warning error
54
54
  return if silence_log? error
55
55
 
56
- Logger.instance.warning error.message
56
+ Logger.instance.warning error.message, error.exception
57
57
 
58
58
  # For easier testing
59
59
  return if @output.nil?
@@ -105,7 +105,6 @@ module Rookout
105
105
 
106
106
  private
107
107
 
108
- # rubocop:disable Style/StderrPuts
109
108
  def connection_thread
110
109
  backoff = Backoff.new
111
110
 
@@ -115,7 +114,8 @@ module Rookout
115
114
 
116
115
  if @print_on_initial_connection
117
116
  @print_on_initial_connection = false
118
- $stderr.puts "[Rookout] Successfully connected to controller"
117
+ Utils.quiet_puts "[Rookout] Successfully connected to controller"
118
+ Utils.quiet_puts "[Rookout] Rook's ID is #{@agent_id}"
119
119
  end
120
120
  Logger.instance.debug "WebSocket connected successfully"
121
121
  Logger.instance.info "Finished initialization"
@@ -139,13 +139,11 @@ module Rookout
139
139
  rescue Exception => e
140
140
  Logger.instance.error "Unexpected error in connection_thread", e
141
141
  end
142
- # rubocop:enable Style/StderrPuts
143
142
 
144
143
  def open_new_connection
145
144
  client = WebsocketClient.new @uri, @proxy, @token
146
145
  client.connect
147
146
 
148
- Logger.instance.info "Registering agent with id #{@agent_id}"
149
147
  msg = Com::Rookout::NewAgentMessage.new agent_info: @info.pack
150
148
  client.send_frame wrap_in_envelope(msg)
151
149
 
@@ -29,7 +29,9 @@ 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
- @serializer.string_cache.each { |key, value| @aug_report_message.strings_cache[key] = value }
32
+ @serializer.string_cache.each do |key, value|
33
+ @aug_report_message.strings_cache[key.encode "UTF-8", invalid: :replace, undef: :replace, replace: "?"] = value
34
+ end
33
35
  @envelope = wrap_in_envelope @aug_report_message
34
36
  @aug_report_message = nil
35
37
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "17ed82e31d57aaaecc1244c11f0e10e673069d7e".freeze
2
+ COMMIT = "426414a386441285302fbe4424892b2a98989af5".freeze
3
3
  end
@@ -6,8 +6,10 @@ module Rookout
6
6
  # Magic to allow for module variables to be easily accessible
7
7
  class << self
8
8
  attr_accessor :debug
9
+ attr_accessor :quiet
9
10
 
10
11
  Rookout::Config.debug = false
12
+ Rookout::Config.quiet = false
11
13
 
12
14
  attr_accessor :logger_filename
13
15
  attr_accessor :logger_log_to_stderr
@@ -112,7 +114,7 @@ module Rookout
112
114
  quota = configuration["RUBY_GLOBAL_RATE_LIMIT_QUOTA_MS"]
113
115
  window_size = configuration["RUBY_GLOBAL_RATE_LIMIT_WINDOW_SIZE_MS"]
114
116
 
115
- if quota != "" && window_size != ""
117
+ if quota != "" && !quota.nil? && window_size != "" && !window_size.nil?
116
118
  global_rate_limit = "#{quota}/#{window_size}"
117
119
  end
118
120
  end
@@ -241,7 +241,7 @@ module Rookout
241
241
  def initialize config
242
242
  super "Invalid rate limit configuration: #{config}",
243
243
  {
244
- "rate_limit_config" => config
244
+ "config" => config
245
245
  }
246
246
  end
247
247
  end
@@ -4,6 +4,7 @@ module Rookout
4
4
  include Singleton
5
5
 
6
6
  require_relative "config"
7
+ require_relative "utils"
7
8
  require_relative "exceptions"
8
9
  include Exceptions
9
10
 
@@ -91,23 +91,23 @@ module Rookout
91
91
  def dump log_object_errors
92
92
  dump_raw_object @obj, 0, @dump_config, log_object_errors
93
93
  end
94
- end
95
94
 
96
- private
95
+ private
97
96
 
98
- def read_key_as_int key
99
- key_int = key.to_i
100
- return RubyObjectNamespace.new @obj[key_int] if key_int >= 0 && key_int < @obj.length
101
- raise Exceptions::RookKeyNotFound, key
102
- end
97
+ def read_key_as_int key
98
+ key_int = key.to_i
99
+ return RubyObjectNamespace.new @obj[key_int] if key_int >= 0 && key_int < @obj.length
100
+ raise Exceptions::RookKeyNotFound, key
101
+ end
103
102
 
104
- def read_key_from_hash key
105
- return RubyObjectNamespace.new @obj[key] if @obj.key? key
106
- return RubyObjectNamespace.new @obj[key.to_sym] if @obj.key? key.to_s.to_sym
103
+ def read_key_from_hash key
104
+ return RubyObjectNamespace.new @obj[key] if @obj.key? key
105
+ return RubyObjectNamespace.new @obj[key.to_sym] if @obj.key? key.to_s.to_sym
107
106
 
108
- @obj.each { |it, value| return RubyObjectNamespace.new value if it.to_s == key }
107
+ @obj.each { |it, value| return RubyObjectNamespace.new value if it.to_s == key }
109
108
 
110
- raise Exceptions::RookKeyNotFound, key
109
+ raise Exceptions::RookKeyNotFound, key
110
+ end
111
111
  end
112
112
  end
113
113
  end
data/lib/rookout/utils.rb CHANGED
@@ -1,26 +1,34 @@
1
- module Utils
2
- require "securerandom"
1
+ module Rookout
2
+ module Utils
3
+ require "securerandom"
4
+ require_relative "config"
3
5
 
4
- module_function
6
+ module_function
5
7
 
6
- def uuid
7
- SecureRandom.uuid.gsub(/-/, "")
8
- end
8
+ def uuid
9
+ SecureRandom.uuid.gsub(/-/, "")
10
+ end
9
11
 
10
- def milliseconds_to_nanoseconds milliseconds
11
- nano = milliseconds * (10**6)
12
- nano.to_i
13
- end
12
+ def milliseconds_to_nanoseconds milliseconds
13
+ nano = milliseconds * (10**6)
14
+ nano.to_i
15
+ end
14
16
 
15
- def time_to_nanoseconds time_obj
16
- secs = time_obj.to_i
17
- nsecs = time_obj.nsec
18
- ((10**9) * secs) + nsecs
19
- end
20
- end
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
21
29
 
22
- class String
23
- def is_number?
24
- to_f.to_s == self || to_i.to_s == self
30
+ def is_number? string
31
+ true if Float(string) rescue false
32
+ end
25
33
  end
26
34
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.42".freeze
2
+ VERSION = "0.1.44".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.42
4
+ version: 0.1.44
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-09-14 00:00:00.000000000 Z
11
+ date: 2022-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller