rookout 0.1.22 → 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: 1189352fe3bb2817944ec553c3a658bcd0d677781ffee90190521e1ed55189c3
4
- data.tar.gz: 63bf916c9f3140c4bf2be89a3469ffd3f451f37edc4741c39c6336ef1373269c
3
+ metadata.gz: 8b41a3be6ece6ef09531502db594ac06453723797d3c9c0f33e61ffe15a67587
4
+ data.tar.gz: a772b70e1fd6df14a51f1bf74e4938a576ef9b7989692eaf09d658c190789ce2
5
5
  SHA512:
6
- metadata.gz: cace5dbc2f61f8e1987397345061080fecc85cbcaeb065976f8a8ae071621c01b717e46dd98df55a48fd399f7b2f02b467b786b335d9dcf4088e09a3094f1961
7
- data.tar.gz: d33370845b6bb7166c93626e74b73a743d5a799f8b69722bae627561fbd747a36542c2a38e7f3135f099e90415d5b5219775407e942a8f3e25c60939a1be9012
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
 
@@ -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 = "f6730b0a0901306d41b983fb4b7a8c7f85d46c81".freeze
2
+ COMMIT = "5319eced619aa4b48a8cbc41e22e0687dc48897c".freeze
3
3
  end
@@ -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.22".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.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liran Haimovitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-11 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