telegraf 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/lib/telegraf/agent.rb +13 -1
- data/lib/telegraf/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edf8914c868d149edbea7ec6aa18d38d9f82e3dc
|
4
|
+
data.tar.gz: 51ba08970a9e58cd952b97377ab287e56674970b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2be470d1089d37d374db002982a13e4b1056f0ef42939122c8a3d64598b024500e7198e8a191e6dce2fb99738670da5f1871b149798658271b43a9666a3533f7
|
7
|
+
data.tar.gz: 94afc09038051b7ddd687ed699256816d29969e1ce05c52a1b12469a25fdf2c7e6a8ab50f79120091733d3f7f35b623b7ee40250f6a0937a0ba6f5dd721ff245
|
data/.travis.yml
CHANGED
data/lib/telegraf/agent.rb
CHANGED
@@ -5,11 +5,23 @@ module Telegraf
|
|
5
5
|
DEFAULT_URI = 'tcp://localhost:8094'
|
6
6
|
DEFAULT_URI = 'unix:///tmp/telegraf.sock'
|
7
7
|
|
8
|
-
|
8
|
+
attr_reader :uri
|
9
|
+
attr_reader :logger
|
10
|
+
|
11
|
+
def initialize(uri = DEFAULT_CONNECTION, logger: nil)
|
9
12
|
@uri = URI.parse(uri)
|
13
|
+
@logger = logger
|
10
14
|
end
|
11
15
|
|
12
16
|
def write(data)
|
17
|
+
write!(data)
|
18
|
+
rescue => e
|
19
|
+
logger&.error('telegraf') do
|
20
|
+
e.to_s + e.backtrace.join("\n")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def write!(data)
|
13
25
|
socket = connect @uri
|
14
26
|
socket.write dump data
|
15
27
|
ensure
|
data/lib/telegraf/version.rb
CHANGED