riemann-tools 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/riemann/tools/riemann_client_wrapper.rb +41 -27
- data/lib/riemann/tools/version.rb +1 -1
- data/lib/riemann/tools.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa9747ae11420451d621eac1f337dc543d3ee395cfde545ca1b819070ad0caef
|
4
|
+
data.tar.gz: f7d3b2a6493bcf478778a517f57a46179659e6c8b49bbe73c2769a82de3dbf8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70855a5ff26bf7f02a35f80a86348ba3401db6576c6e7b97fa900c5ae134c6d4f4d066a1a6455c83a268442fb38b4a6ed36fae70d1aad3f759db9de97e1aa8fd
|
7
|
+
data.tar.gz: f9658262416652b5844b2f9b25d507e200da60b28ec50d6b8d56c1889b820e0c97457b79faf8feb19eaf7f40f8edb23ebc29676f49a078a478b1e78cc943c6a0
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [v1.8.
|
3
|
+
## [v1.8.1](https://github.com/riemann/riemann-tools/tree/v1.8.1) (2023-02-27)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.8.0...v1.8.1)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Improve event sending thread lifecycle management [\#265](https://github.com/riemann/riemann-tools/pull/265) ([smortex](https://github.com/smortex))
|
10
|
+
- Make sure all events are send before terminating [\#264](https://github.com/riemann/riemann-tools/pull/264) ([smortex](https://github.com/smortex))
|
11
|
+
|
12
|
+
## [v1.8.0](https://github.com/riemann/riemann-tools/tree/v1.8.0) (2023-02-02)
|
4
13
|
|
5
14
|
[Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.7.1...v1.8.0)
|
6
15
|
|
@@ -7,52 +7,66 @@ require 'riemann/client'
|
|
7
7
|
module Riemann
|
8
8
|
module Tools
|
9
9
|
class RiemannClientWrapper
|
10
|
-
|
10
|
+
attr_reader :options
|
11
|
+
|
12
|
+
def initialize(options)
|
13
|
+
@options = options
|
11
14
|
|
12
|
-
def initialize
|
13
|
-
@client = nil
|
14
15
|
@queue = Queue.new
|
15
16
|
@max_bulk_size = 1000
|
16
|
-
|
17
|
-
|
18
|
-
def configure(options)
|
19
|
-
return self unless @client.nil?
|
20
|
-
|
21
|
-
r = Riemann::Client.new(
|
22
|
-
host: options[:host],
|
23
|
-
port: options[:port],
|
24
|
-
timeout: options[:timeout],
|
25
|
-
ssl: options[:tls],
|
26
|
-
key_file: options[:tls_key],
|
27
|
-
cert_file: options[:tls_cert],
|
28
|
-
ca_file: options[:tls_ca_cert],
|
29
|
-
ssl_verify: options[:tls_verify],
|
30
|
-
)
|
31
|
-
|
32
|
-
@client = if options[:tcp] || options[:tls]
|
33
|
-
r.tcp
|
34
|
-
else
|
35
|
-
r
|
36
|
-
end
|
17
|
+
@draining = false
|
37
18
|
|
38
19
|
@worker = Thread.new do
|
20
|
+
Thread.current.abort_on_exception = true
|
39
21
|
loop do
|
40
22
|
events = []
|
41
23
|
|
42
24
|
events << @queue.pop
|
43
25
|
events << @queue.pop while !@queue.empty? && events.size < @max_bulk_size
|
44
26
|
|
45
|
-
|
27
|
+
client.bulk_send(events)
|
28
|
+
rescue Riemann::Client::Error => e
|
29
|
+
warn "Dropping #{events.size} event#{'s' if events.size > 1} due to #{e}"
|
30
|
+
rescue StandardError => e
|
31
|
+
warn "#{e.class} #{e}\n#{e.backtrace.join "\n"}"
|
32
|
+
Thread.main.terminate
|
46
33
|
end
|
47
34
|
end
|
48
|
-
@worker.abort_on_exception = true
|
49
35
|
|
50
|
-
|
36
|
+
at_exit { drain }
|
37
|
+
end
|
38
|
+
|
39
|
+
def client
|
40
|
+
@client ||= begin
|
41
|
+
r = Riemann::Client.new(
|
42
|
+
host: options[:host],
|
43
|
+
port: options[:port],
|
44
|
+
timeout: options[:timeout],
|
45
|
+
ssl: options[:tls],
|
46
|
+
key_file: options[:tls_key],
|
47
|
+
cert_file: options[:tls_cert],
|
48
|
+
ca_file: options[:tls_ca_cert],
|
49
|
+
ssl_verify: options[:tls_verify],
|
50
|
+
)
|
51
|
+
|
52
|
+
if options[:tcp] || options[:tls]
|
53
|
+
r.tcp
|
54
|
+
else
|
55
|
+
r
|
56
|
+
end
|
57
|
+
end
|
51
58
|
end
|
52
59
|
|
53
60
|
def <<(event)
|
61
|
+
raise('Cannot queue events when draining') if @draining
|
62
|
+
|
54
63
|
@queue << event
|
55
64
|
end
|
65
|
+
|
66
|
+
def drain
|
67
|
+
@draining = true
|
68
|
+
sleep(1) until @queue.empty? || @worker.stop?
|
69
|
+
end
|
56
70
|
end
|
57
71
|
end
|
58
72
|
end
|
data/lib/riemann/tools.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Kingsbury
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -367,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
367
367
|
- !ruby/object:Gem::Version
|
368
368
|
version: '0'
|
369
369
|
requirements: []
|
370
|
-
rubygems_version: 3.4.
|
370
|
+
rubygems_version: 3.4.5
|
371
371
|
signing_key:
|
372
372
|
specification_version: 4
|
373
373
|
summary: Utilities which submit events to Riemann.
|