soar_auditing_provider 1.1.0 → 1.1.1

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
  SHA1:
3
- metadata.gz: 9cfff41987c79b02a5a35893b286b3770ecaa9f6
4
- data.tar.gz: 696249e89783169ff5c77c50b77638595d740a94
3
+ metadata.gz: 533e50f96d003eaf80b09fa70ec1154c7c28478f
4
+ data.tar.gz: 69cac5833f72d7f332f364cad8799ff091293e30
5
5
  SHA512:
6
- metadata.gz: 5050b6588dbdded12927a93bc6d9dc76f55f51ebb2950a1c6a122d7b795b2d8fdd4e6562ad26e63e70e5c5f78673b9398f5c1adb34fec334bfa40e96f7b604d3
7
- data.tar.gz: 98f9cd2beedff794442784f18067e521b6e2a5c16ba1c0440e445d19a16ffd83aaf6f92a68bb78e95d4d020c0246b259bd604e72ef57b8d407614e7d9209bd67
6
+ metadata.gz: d7d3045035d9b59331a9d34a19ca88f52628f25dcd0bca2ea983ce2bd86562241576975040be9558072915a6a8fd4a529384cd344bd388e0f6930725a9e3116e
7
+ data.tar.gz: 614ffb3a1b13cb9e884ca84293ceabe88037dec32bfe56aa2d9c741b02d00e5c88c8ca2b97f8ab8ed49c481f7ec3551a6a398d2a289542e9bc68f31c877dac6a
@@ -69,7 +69,12 @@ module SoarAuditingProvider
69
69
 
70
70
  def detailed_status
71
71
  { 'audit_buffer_overflows' => @buffer_overflow_count,
72
- 'startup_flow_id' => @startup_flow_id }
72
+ 'startup_flow_id' => @startup_flow_id,
73
+ 'failed_audit_attempts' => @worker.failed_audit_attempts,
74
+ 'successful_audits' => @worker.successful_audits,
75
+ 'total_audits' => @worker.total_audits,
76
+ 'latest_audit_timespan' => @worker.latest_audit_timespan,
77
+ 'latest_audit_timestamp' => @worker.latest_audit_timestamp }
73
78
  end
74
79
 
75
80
  def flush
@@ -2,9 +2,16 @@ require 'soar_thread_worker/thread_worker'
2
2
 
3
3
  module SoarAuditingProvider
4
4
  class AuditingWorker < SoarThreadWorker::ThreadWorker
5
+ attr_reader :failed_audit_attempts
6
+ attr_reader :successful_audits
7
+ attr_reader :total_audits
8
+ attr_reader :latest_audit_timespan
9
+ attr_reader :latest_audit_timestamp
10
+
5
11
  def initialize
6
12
  @queue = Queue.new
7
13
  @start_mutex = Mutex.new
14
+ initialize_metrics
8
15
  end
9
16
 
10
17
  def configure(queue_worker_configuration: ,auditor_audit_method: )
@@ -36,6 +43,7 @@ module SoarAuditingProvider
36
43
 
37
44
  def execute
38
45
  audit_event = @queue.pop
46
+ @total_audits += 1
39
47
  failed_before = false
40
48
  begin
41
49
  if @stopping
@@ -43,13 +51,17 @@ module SoarAuditingProvider
43
51
  return true #indicates to thread worder that we are done executing since we are in the process of stopping
44
52
  end
45
53
  exponential_back_off(start_at_last_attempt: failed_before) {
54
+ time_before_audit = Time.now
46
55
  @auditor_audit_method.call(audit_event[:level],audit_event[:data])
56
+ @latest_audit_timespan = Time.now - time_before_audit
57
+ @successful_audits += 1
47
58
  }
48
59
  rescue Exception => e
49
60
  print_exception_with_message_to_stderr(nil,e)
50
61
  failed_before = true
51
62
  retry
52
63
  end
64
+ @latest_audit_timestamp = Time.now.utc
53
65
  return false #indicates to thread worder that we are not done executing
54
66
  end
55
67
 
@@ -122,6 +134,7 @@ module SoarAuditingProvider
122
134
  # Any exception derived from StandardError is assumed to be a failure and
123
135
  # attempted again until it completes without an exception or an exception
124
136
  # not derived from StandardError
137
+ @failed_audit_attempts += 1
125
138
  if ((attempt <= @maximum_back_off_attempts) and (not @stopping)) then
126
139
  sleep_unless_stopping(calculate_back_off_delay(attempt))
127
140
  attempt = attempt + 1
@@ -149,5 +162,13 @@ module SoarAuditingProvider
149
162
  sleep(0.1)
150
163
  end
151
164
  end
165
+
166
+ def initialize_metrics
167
+ @failed_audit_attempts = 0
168
+ @successful_audits = 0
169
+ @total_audits = 0
170
+ @latest_audit_timespan = 0
171
+ @latest_audit_timestamp = 0
172
+ end
152
173
  end
153
174
  end
@@ -1,3 +1,3 @@
1
1
  module SoarAuditingProvider
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar_auditing_provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-09-14 00:00:00.000000000 Z
12
+ date: 2016-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler