rookout 0.1.20 → 0.1.24

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: 481ca24b7cd172e3416b29fee18905c6282d589db6cb316b2aa4d5adab26da1a
4
- data.tar.gz: 5e391b43a1e7177ef5c020bc64d133fb9e62810bc4596301b2ed7298d18182d6
3
+ metadata.gz: 74fa18f4c9039ebbfe3b13b7925213882bfe694e1084854d0e9765da7f9e89de
4
+ data.tar.gz: 9648b79a995a4ab76b80e4fec26a4f9208c2d5ed5aa1dca2f32fbfd07cd69d90
5
5
  SHA512:
6
- metadata.gz: 30d63371644e94dba222b0e63650158d92f1de63e96d4731dd4eaa300c6a8e2d8220cd6f93fdcc0fdee5aaf390d3170bb52ebbcb7e82d2611228a7341c15faed
7
- data.tar.gz: 5d0c24c4f132464d38b547d68f221983500fb76d7a6a4b438378abdb5d6f3bfb7f924e8784ac64b9da9642f7f84b2bf5c9facaa835a2f3d75d103d4e72df615c
6
+ metadata.gz: 9eb0e942f1522c6f13e190921ac5fdb895533ddb216dbe4a2e6920971e2281760a4c61e74eb975bf0144a73d3432222a5c9b485c1895290433ffc694f2ed2dd1
7
+ data.tar.gz: c21492f79edeb64879b18590934f31cfd366b61b63fd3d16744531e5c9ae7513339aff468bf3ac6055d534e3298d18d946023ffd9cb3b436dc0500060aabba63
@@ -28,6 +28,11 @@ module Rookout
28
28
  def execute frame, extracted, output
29
29
  return unless @enabled
30
30
 
31
+ if output.user_messages_queue_full?
32
+ Logger.instance.warning "Skipping aug-\t#{id} execution because the queue is full"
33
+ return
34
+ end
35
+
31
36
  namespace = create_namespaces frame, extracted
32
37
  return if @condition && !@condition.evaluate(namespace)
33
38
 
@@ -45,7 +45,7 @@ module Rookout
45
45
 
46
46
  def create_location configuration, aug
47
47
  name = configuration["name"]
48
- raise Exceptions.RookObjectNameMissing if name.nil?
48
+ raise Exceptions::RookObjectNameMissing if name.nil?
49
49
 
50
50
  case name
51
51
  when "file_line"
@@ -53,7 +53,7 @@ module Rookout
53
53
  when "exception_handler"
54
54
  return Locations::LocationExceptionHandler.new configuration, @output, aug
55
55
  else
56
- raise Exceptions.RookUnsupportedLocation if name != "file_line"
56
+ raise Exceptions::RookUnsupportedLocation if name != "file_line"
57
57
  end
58
58
  end
59
59
 
@@ -23,6 +23,8 @@ module Rookout
23
23
  class AgentComWs
24
24
  include EventEmitter
25
25
 
26
+ attr_reader :pending_messages
27
+
26
28
  def initialize output, agent_host, agent_port, proxy, token, labels
27
29
  agent_host_with_protocl = agent_host.include?("://") ? agent_host : "ws://#{agent_host}"
28
30
  @uri = "#{agent_host_with_protocl}:#{agent_port}/v1"
@@ -62,6 +64,10 @@ module Rookout
62
64
  @pending_messages.push buffer if @pending_messages.length < Config.agent_com_max_queued_messages
63
65
  end
64
66
 
67
+ def queue_full?
68
+ @pending_messages.length >= Config.agent_com_max_queued_messages
69
+ end
70
+
65
71
  def connect
66
72
  @running = true
67
73
 
@@ -11,11 +11,16 @@ module Rookout
11
11
  require_relative "git"
12
12
  include Git
13
13
 
14
- def initialize labels
14
+ def initialize labels, k8s_file_path = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
15
15
  @agent_id = nil
16
16
  @labels = labels.clone
17
17
  @labels["rookout_debug"] = "on" if Config.debug
18
18
 
19
+ k8_namespace = create_cluster_namespace k8s_file_path
20
+ unless k8_namespace == ""
21
+ @labels["k8s_namespace"] = k8_namespace
22
+ end
23
+
19
24
  @ip_addr = local_ip
20
25
 
21
26
  @scm_info = create_scm_information
@@ -49,7 +54,7 @@ module Rookout
49
54
  scm: @scm_info
50
55
  end
51
56
 
52
- attr_accessor :agent_id
57
+ attr_accessor :agent_id, :labels
53
58
 
54
59
  private
55
60
 
@@ -65,6 +70,18 @@ module Rookout
65
70
  end
66
71
  # rubocop:enable Style/ParallelAssignment
67
72
 
73
+ def create_cluster_namespace k8s_file_path
74
+ return_value = ""
75
+
76
+ # No Kubernetes is valid
77
+ if File.file? k8s_file_path
78
+ # Read the file contents and return it as result
79
+ return_value = File.read k8s_file_path
80
+ end
81
+
82
+ return_value
83
+ end
84
+
68
85
  def create_scm_information
69
86
  user_git_origin = Config.user_git_origin || ENV["ROOKOUT_REMOTE_ORIGIN"]
70
87
  user_git_commit = Config.user_git_commit || ENV["ROOKOUT_COMMIT"]
@@ -49,6 +49,10 @@ module Rookout
49
49
  Logger.instance.remove_output self
50
50
  end
51
51
 
52
+ def user_messages_queue_full?
53
+ @user_message_bucket.exhausted? || (!@agent_com.nil? && @agent_com.queue_full?)
54
+ end
55
+
52
56
  def send_warning rule_id, error
53
57
  send_rule_status rule_id, :Warning, error
54
58
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "f63d232fa7d56db9e3a82bdbbe8a1eafaea49ab3".freeze
2
+ COMMIT = "9ab942ecb3c996d6e4fc6516d79a95aa15bd1c95".freeze
3
3
  end
@@ -25,7 +25,7 @@ module Rookout
25
25
  Rookout::Config.agent_com_ping_interval = 10
26
26
  Rookout::Config.agent_com_ping_timeout = 30
27
27
  Rookout::Config.agent_com_flush_timeout = 3
28
- Rookout::Config.agent_com_max_queued_messages = 500
28
+ Rookout::Config.agent_com_max_queued_messages = 100
29
29
 
30
30
  attr_accessor :backoff_factor, :backoff_reset_time, :backoff_max_time
31
31
  Rookout::Config.backoff_factor = 0.2
@@ -201,5 +201,23 @@ module Rookout
201
201
  super "Bad protobuf platform: #{platform}"
202
202
  end
203
203
  end
204
+
205
+ class RookObjectNameMissing < ToolException
206
+ def initialize configuration
207
+ super "Failed to find object name",
208
+ {
209
+ "configuration" => configuration
210
+ }
211
+ end
212
+ end
213
+
214
+ class RookUnsupportedLocation < ToolException
215
+ def initialize location
216
+ super "Unsupported aug location was specified: #{location}",
217
+ {
218
+ "location" => location
219
+ }
220
+ end
221
+ end
204
222
  end
205
223
  end
@@ -35,9 +35,9 @@ module Rookout
35
35
  dump_string obj, variant, config
36
36
  elsif obj.is_a? Time
37
37
  dump_time obj, variant
38
- elsif obj.is_a? Array
38
+ elsif obj.class == Array
39
39
  dump_array obj, variant, current_depth, config, log_object_errors
40
- elsif obj.is_a? Hash
40
+ elsif obj.class == Hash
41
41
  dump_hash obj, variant, current_depth, config, log_object_errors
42
42
  elsif obj.is_a? Exception
43
43
  dump_exception obj, variant, current_depth, config, log_object_errors
@@ -20,7 +20,7 @@ module Rookout
20
20
 
21
21
  begin
22
22
  trace_point.enable target: position.method, target_line: position.lineno
23
- rescue ArgumentError => e
23
+ rescue RuntimeError, ArgumentError => e
24
24
  raise Exceptions::RookSetTracepointFailed.new(position.lineno, e)
25
25
  end
26
26
 
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.20".freeze
2
+ VERSION = "0.1.24".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.20
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liran Haimovitch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-07 00:00:00.000000000 Z
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -253,7 +253,7 @@ licenses:
253
253
  - Proprietary
254
254
  metadata:
255
255
  homepage_uri: https://rookout.com
256
- post_install_message:
256
+ post_install_message:
257
257
  rdoc_options: []
258
258
  require_paths:
259
259
  - lib
@@ -268,8 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
- rubygems_version: 3.1.4
272
- signing_key:
271
+ rubygems_version: 3.1.6
272
+ signing_key:
273
273
  specification_version: 4
274
274
  summary: rookout is the Ruby SDK for the Rookout Debugging Platform
275
275
  test_files: []