data_collector 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/data_collector/ext/base.rb +12 -16
- data/lib/data_collector/input/generic.rb +1 -1
- data/lib/data_collector/input/rpc.rb +1 -1
- data/lib/data_collector/output/generic.rb +2 -1
- data/lib/data_collector/output/rpc.rb +1 -1
- data/lib/data_collector/output.rb +1 -1
- data/lib/data_collector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1345f920eefd428837193e35ec9e63d7213deebf4445685bb4c0c1d56c47b3a4
|
4
|
+
data.tar.gz: 33380a284a385eb268b2b42fc45e4e082bbb8ccdb7856ab43feef2bf55ff48fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17483e3ba00c9a3b137c1f0c6aa0b9655b02d81cd04c45cecc85e657defd21b4681d0f204dad999eb8ba372f2418aca026a0ddb10e62863dfdaf283bfeaaba07
|
7
|
+
data.tar.gz: 874443f2821d2a0387547ff7e936d52d2742eab12dd51fb73b67121a3fc332cf7c82a51d574481111fd98ab8ffaed82ec103cec08598aa44a0ef5c183b3c1dd2
|
@@ -3,55 +3,51 @@ require 'connection_pool'
|
|
3
3
|
module BunnyBurrow
|
4
4
|
class Connection
|
5
5
|
include Singleton
|
6
|
-
attr_reader :connection
|
7
|
-
attr_accessor :verify_peer, :
|
6
|
+
attr_reader :connection
|
7
|
+
attr_accessor :verify_peer, :connection_name, :rabbitmq_url
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
super
|
11
|
-
@started = false
|
12
|
-
end
|
13
9
|
def connection
|
14
|
-
@connection
|
15
|
-
|
10
|
+
unless @connection
|
11
|
+
@connection = Bunny.new(@rabbitmq_url, verify_peer: @verify_peer, connection_name: @connection_name)
|
16
12
|
@connection.start
|
17
|
-
@started = true
|
18
13
|
end
|
19
14
|
|
20
15
|
@connection
|
21
16
|
end
|
22
17
|
|
23
18
|
def channel
|
24
|
-
@channel ||=
|
25
|
-
|
26
|
-
|
19
|
+
@channel ||= connection.create_channel
|
20
|
+
|
21
|
+
@channel
|
27
22
|
end
|
28
23
|
end
|
29
24
|
|
30
25
|
class Base
|
31
26
|
attr_accessor(
|
32
|
-
:
|
27
|
+
:connection_name
|
33
28
|
)
|
34
29
|
|
35
30
|
private
|
36
31
|
|
37
32
|
def connection
|
38
|
-
Connection.instance.
|
33
|
+
Connection.instance.connection_name = @connection_name
|
39
34
|
Connection.instance.verify_peer = @verify_peer
|
40
35
|
Connection.instance.rabbitmq_url = @rabbitmq_url
|
41
36
|
|
42
37
|
unless @connection
|
43
38
|
@connection = Connection.instance.connection
|
39
|
+
@connection.start unless @connection.open?
|
44
40
|
end
|
45
41
|
|
46
42
|
@connection
|
47
43
|
end
|
48
44
|
|
49
45
|
def channel
|
50
|
-
Connection.instance.
|
46
|
+
Connection.instance.connection_name = @connection_name
|
51
47
|
Connection.instance.verify_peer = @verify_peer
|
52
48
|
Connection.instance.rabbitmq_url = @rabbitmq_url
|
53
49
|
|
54
|
-
@channel
|
50
|
+
@channel = Connection.instance.channel
|
55
51
|
end
|
56
52
|
end
|
57
53
|
end
|
@@ -11,6 +11,7 @@ module DataCollector
|
|
11
11
|
@options = options
|
12
12
|
@running = false
|
13
13
|
|
14
|
+
@name = options[:name] || "output-#{Time.now.to_i}-#{rand(10000)}"
|
14
15
|
create_producer
|
15
16
|
end
|
16
17
|
|
@@ -31,7 +32,7 @@ module DataCollector
|
|
31
32
|
end
|
32
33
|
|
33
34
|
private
|
34
|
-
def create_producer
|
35
|
+
def create_producer(log = false)
|
35
36
|
raise DataCollector::Error, 'Please implement a producer'
|
36
37
|
end
|
37
38
|
|
@@ -25,7 +25,7 @@ module DataCollector
|
|
25
25
|
parse_uri
|
26
26
|
client.rabbitmq_url = @bunny_uri.to_s
|
27
27
|
client.rabbitmq_exchange = @bunny_channel
|
28
|
-
|
28
|
+
client.connection_name = @name
|
29
29
|
|
30
30
|
client.logger = DataCollector::Core.logger if log
|
31
31
|
@running = true
|
@@ -182,7 +182,7 @@ module DataCollector
|
|
182
182
|
raise "unable to save to file: #{e.message}"
|
183
183
|
end
|
184
184
|
|
185
|
-
def to_jsonfile
|
185
|
+
def to_jsonfile(jsondata, jsonfile)
|
186
186
|
raise '[DEPRECATED] `to_jsonfile` deprecated. Please use `to_uri("file://abc.json", {template: "template.erb", content_type: "application/json"})` instead'
|
187
187
|
rescue Exception => e
|
188
188
|
raise "unable to save to jsonfile: #{e.message}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.40.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|