rookout 0.1.46 → 0.1.50

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: b59aefa8a8063910a6a7ec3446c7f709a9781468e786993f2b7ae84b47c284cc
4
- data.tar.gz: 91fc89ae75510ab8a81de5da86a3619c2f17d6a2920aa72d9f718436ac1b7056
3
+ metadata.gz: 72f208b3a47ef61e59b2123afe3e666a2f3efa8295ddec10950e221e5547770a
4
+ data.tar.gz: 216a478be4998de21db6b2df156123d6cde587a54369914d93ba2f3ef8f9b5a7
5
5
  SHA512:
6
- metadata.gz: 0b9a998c2f766b42e115e103e92883807c813d9bdb583d6f9eaf148ead19de00d8fd71dae6a98a88dcfdbcd028634ff5de865410911b7ffcae92ff84bf224c20
7
- data.tar.gz: b5ee7cf8ff1af74a6718d5abfd5d87e56ca7a521d470449abab7d07c525e32fa5f979e7b97553340dfd5a2b35618573ec10f4c2855cfc7ed24ccf5d2495abd07
6
+ metadata.gz: c9c2e1c91cba199a499fb360f519dcce9081f9c5693cf9919aaff369cd2389534900be7b580e03a3b9ef24e91394db0eec9d25e3968163de87a9390aec288392
7
+ data.tar.gz: 476c8d023ae8e04214693c3b929d0dae31bcf364cf23cc443bf3aab2c29bd05f08db4646a366cb54b4b5208d188df22024886bd35421849c73e331db720eb960
@@ -16,6 +16,7 @@ module Rookout
16
16
  @condition = condition
17
17
  @limits_manager = limits_manager
18
18
 
19
+ @executed = false
19
20
  @enabled = true
20
21
  @status = nil
21
22
  @log_cache = []
@@ -34,7 +35,9 @@ module Rookout
34
35
  namespace = create_namespaces frame, extracted
35
36
  return if @condition && !@condition.evaluate(namespace)
36
37
 
37
- @limits_manager.with_limit do
38
+ should_skip_limiters = @condition.nil? && !@executed
39
+ @limits_manager.with_limit should_skip_limiters do
40
+ @executed = true
38
41
  report_id = Utils.uuid
39
42
  Logger.instance.info "Executing aug-\t#{id} (msg ID #{report_id})"
40
43
  @action.execute @id, report_id, namespace, output
@@ -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, 1
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, Rookout::Config.global_rate_limit_multiplier
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, multiplier
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 * multiplier, window_size_ns, rate_limit_modifier]
132
+ [window_quota_ns, window_size_ns, rate_limit_modifier]
133
133
  end
134
134
  end
135
135
  end
@@ -5,13 +5,14 @@ module Rookout
5
5
  @limiters = limiters
6
6
  end
7
7
 
8
- def with_limit start_time = nil
8
+ def with_limit skip_limiters, start_time = nil
9
9
  start_time ||= Time.now
10
10
  can_execute = true
11
11
  after_execute = []
12
12
 
13
13
  @limiters.each do |limiter|
14
- if limiter.before_run start_time
14
+ limiter_passed = limiter.before_run start_time
15
+ if limiter_passed || skip_limiters
15
16
  after_execute.append -> { limiter.after_run start_time }
16
17
  else
17
18
  can_execute = false
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "ec556ada7fc1b5196406db4ed39b386974440d91".freeze
2
+ COMMIT = "9f3ecb29fbadc0c8f66233c9c44be100a912e577".freeze
3
3
  end
@@ -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
@@ -146,6 +146,13 @@ module Rookout
146
146
  end
147
147
  end
148
148
 
149
+ class RookInvalidPositionException < ToolException
150
+ def initialize filename, line
151
+ super "Invalid code position for TracePoint: #{filename}:#{line}",
152
+ { filename: filename, line: line }
153
+ end
154
+ end
155
+
149
156
  class RookObjectCannotBeSerialized < ToolException
150
157
  def initialize object, message
151
158
  super message, { "class" => object.class.to_s }
@@ -21,6 +21,9 @@ module Rookout
21
21
  begin
22
22
  trace_point.enable target: position.method, target_line: position.lineno
23
23
  rescue RuntimeError, ArgumentError => e
24
+ if e.message.include? "can not enable any hooks"
25
+ raise Exceptions::RookInvalidPositionException.new(aug.filename, position.lineno)
26
+ end
24
27
  raise Exceptions::RookSetTracepointFailed.new(position.lineno, e)
25
28
  end
26
29
 
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.46".freeze
2
+ VERSION = "0.1.50".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.46
4
+ version: 0.1.50
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-18 00:00:00.000000000 Z
11
+ date: 2023-02-09 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.19.2
75
+ version: 3.21.7
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.19.2
82
+ version: 3.21.7
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: google-style
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  - !ruby/object:Gem::Version
302
302
  version: '0'
303
303
  requirements: []
304
- rubygems_version: 3.3.7
304
+ rubygems_version: 3.3.26
305
305
  signing_key:
306
306
  specification_version: 4
307
307
  summary: rookout is the Ruby SDK for the Rookout Debugging Platform