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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25b090ca81a07cf0e4ac08117baa85c2e03cc499
4
- data.tar.gz: e359b8f1e0fbbbc2f46a657d2cbea5e8e48cac59
3
+ metadata.gz: edf8914c868d149edbea7ec6aa18d38d9f82e3dc
4
+ data.tar.gz: 51ba08970a9e58cd952b97377ab287e56674970b
5
5
  SHA512:
6
- metadata.gz: 70d1dcb7e07902177bc52666ac844d131573e70d8c728b76ce6263adca2313a4f4147c993658fe9ccae000488575564914959feacc7effbe52003ba3e44021f5
7
- data.tar.gz: 4b32abd426447f55bee32d549a225612ed6352e4dcbd54fe56037cb30a25294a9d2f9ac60e8f56c67ec20f958a30b80672d10eea0a06fa7581e2b2b5ec83bbff
6
+ metadata.gz: 2be470d1089d37d374db002982a13e4b1056f0ef42939122c8a3d64598b024500e7198e8a191e6dce2fb99738670da5f1871b149798658271b43a9666a3533f7
7
+ data.tar.gz: 94afc09038051b7ddd687ed699256816d29969e1ce05c52a1b12469a25fdf2c7e6a8ab50f79120091733d3f7f35b623b7ee40250f6a0937a0ba6f5dd721ff245
@@ -3,5 +3,6 @@ dist: trusty
3
3
  language: ruby
4
4
  rvm:
5
5
  - 2.4.1
6
+ - 2.3.4
6
7
  before_install:
7
8
  - gem install bundler -v 1.15.1
@@ -5,11 +5,23 @@ module Telegraf
5
5
  DEFAULT_URI = 'tcp://localhost:8094'
6
6
  DEFAULT_URI = 'unix:///tmp/telegraf.sock'
7
7
 
8
- def initialize(uri = DEFAULT_CONNECTION)
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
@@ -3,7 +3,7 @@
3
3
  module Telegraf
4
4
  module VERSION
5
5
  MAJOR = 0
6
- MINOR = 1
6
+ MINOR = 2
7
7
  PATCH = 0
8
8
  STAGE = nil
9
9
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.').freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegraf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen