rookout 0.1.19 → 0.1.23

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: f0a6779a6336398a744919c44647b6d63cb1c7178c9063545f70530954750e74
4
- data.tar.gz: 498661e2d876a90a3df2e91c63e4ecef923bffab7dc1a08c375c43708a85018a
3
+ metadata.gz: 8b41a3be6ece6ef09531502db594ac06453723797d3c9c0f33e61ffe15a67587
4
+ data.tar.gz: a772b70e1fd6df14a51f1bf74e4938a576ef9b7989692eaf09d658c190789ce2
5
5
  SHA512:
6
- metadata.gz: bd968a36a0e0cdb97bc6032d2f2e916099b7bde3f01cbe78c99985cc352b98f784c02b50a9b6f07bb3259113dbbc1cc30b2d5a08bdf7f830e3486904b00f7315
7
- data.tar.gz: b0a1d91c5461c758363e4e5d2a28f25f41d81592b549e8374b08580a99c0ee7c6485c66ef71644cf19aff6cfc30244ba9de55a51b3cbc9b3c3eb84a46cb4f627
6
+ metadata.gz: 7b81e9fb7362fdf9abb57988d9dc2eb0acc099c5149243b1bf4d787c4e05d5aa4f3bc3602214eba23742ba152ac90fc18342a6abd5b872189b53626f007cea71
7
+ data.tar.gz: 012b9eb8d6a15ba2f267190bc1edd1adea15472bc288e78d936cb592a2726b9bac66ba06067ab111e3757fc3562b8df95d69b013e38a2567f0b4c47385900106
@@ -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
@@ -22,7 +22,7 @@ module Rookout
22
22
  Logger.instance.debug "Got Ping reply"
23
23
  @last_pong = Time.now
24
24
  end
25
- rescue RuntimeError
25
+ rescue RuntimeError, Errno::EPIPE
26
26
  Logger.instance.debug "Failed to send ping"
27
27
  break
28
28
  end
@@ -65,7 +65,7 @@ module Rookout
65
65
 
66
66
  begin
67
67
  @driver.close
68
- rescue RuntimeError
68
+ rescue RuntimeError, Errno::EPIPE
69
69
  # Protocol close may fail if the connection is already closed
70
70
  nil
71
71
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "d73fb2179498d7e9dd75c474b5b5aeee97db687b".freeze
2
+ COMMIT = "5319eced619aa4b48a8cbc41e22e0687dc48897c".freeze
3
3
  end
@@ -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.19".freeze
2
+ VERSION = "0.1.23".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.19
4
+ version: 0.1.23
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-01-24 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -84,14 +84,14 @@ dependencies:
84
84
  name: google-style
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.24.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.24.0
97
97
  - !ruby/object:Gem::Dependency
@@ -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: []