fluent-plugin-statsd-output 1.3.0 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e02ca71e2584cc505e7d2cd91786b363f5a5f8ea
4
- data.tar.gz: 0fa458b0c88ef4b7c231a75953f62dcf9d5c176f
3
+ metadata.gz: 3cd9b0f7773c17c051439293fcfe14ce3e60cbd3
4
+ data.tar.gz: 3929c05cbb5e59c45aaddb932b884bfff9c015bc
5
5
  SHA512:
6
- metadata.gz: b7751ed95c4d45e9c772419104a3c507a115c30f849c99af691c2fb5e6f278bf9e3a0835073a34c9a99b0f9441015a169db8b3134646c2cea70253e6634e5fe3
7
- data.tar.gz: 0fffe9cfdc7a6b5fd0b7601536ba3b8090cf2eb628178efb721d1cd8a0b12c9e5efe9be390529af186b36a569088e80102ecd6b3c43f4a36c9842c12652104f8
6
+ metadata.gz: 24e3bf9bc969f442d5b0fd5d0a3b8c82c5225858b34abfe357abd015a6f34522d3e08e2f440d07a5577aa56b0b2bcb22ec7906e04553e67b581418d098d6a1b8
7
+ data.tar.gz: ec042e836c84efd055fa70b859e7355b7d0776bc85bd18f9d23a09f35e9fd3c009d67ad22a0877d3419e08e1fa0055168b56fb71a41f98b204c73e6b09df2087
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-statsd-output (1.2.0)
4
+ fluent-plugin-statsd-output (1.3.0)
5
5
  fluentd (>= 0.10.8)
6
6
  statsd-ruby (~> 1.4)
7
7
 
@@ -68,4 +68,4 @@ DEPENDENCIES
68
68
  test-unit
69
69
 
70
70
  BUNDLED WITH
71
- 1.14.6
71
+ 1.15.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -95,7 +95,7 @@ module Fluent
95
95
 
96
96
  def parse(string)
97
97
  return unless string
98
- string.gsub(/\$\{.+\}/) {|str| @obj.instance_eval str[2..-2] }
98
+ string.gsub(/\$\{[^\}]+\}/) {|str| @obj.instance_eval str[2..-2] }
99
99
  end
100
100
  end
101
101
  end
@@ -0,0 +1,55 @@
1
+ require 'fluent/plugin/out_statsd'
2
+ require 'fluent/test'
3
+
4
+ RSpec.describe Fluent::StatsdOutput do
5
+ let(:config) do
6
+ %{
7
+ type statsd
8
+
9
+ <metric>
10
+ statsd_type increment
11
+ statsd_key res_code_${record['hostname']}_${record['status'].to_i / 100}xx
12
+ </metric>
13
+ }
14
+ end
15
+ let(:driver) { create_driver(config) }
16
+ let(:statsd) { double('statsd', increment: true,
17
+ flush: true,
18
+ 'namespace=' => true,
19
+ 'batch_size=' => true,
20
+ 'batch_byte_size' => true)
21
+
22
+ }
23
+ let(:time) { Time.now.utc }
24
+
25
+ before :all do
26
+ Fluent::Test.setup
27
+ end
28
+
29
+ def create_driver(conf)
30
+ Fluent::Test::BufferedOutputTestDriver.new(Fluent::StatsdOutput) {
31
+ }.configure(conf)
32
+ end
33
+
34
+ def emit_events(events)
35
+ events.each {|e| driver.emit(e, time) }
36
+ end
37
+
38
+
39
+ it 'should call statsd with events data and correctly handle multiple placeholders' do
40
+ allow(Statsd).to receive(:new).and_return(statsd)
41
+
42
+ expect(statsd).to receive(:increment).with('res_code_localhost_2xx').twice.times
43
+ expect(statsd).to receive(:increment).with('res_code_localhost_4xx').once.times
44
+ expect(statsd).to receive(:increment).with('res_code_localhost_5xx').once.times
45
+
46
+ emit_events([
47
+ {'hostname' => 'localhost', 'response_time' => 102, 'status' => '200'},
48
+ {'hostname' => 'localhost', 'response_time' => 105, 'status' => '200'},
49
+ {'hostname' => 'localhost', 'response_time' => 112, 'status' => '400'},
50
+ {'hostname' => 'localhost', 'response_time' => 125, 'status' => '500'}
51
+ ])
52
+
53
+ driver.run
54
+ end
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-statsd-output
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Song
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-05 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -96,6 +96,7 @@ files:
96
96
  - VERSION
97
97
  - fluent-plugin-statsd.gemspec
98
98
  - lib/fluent/plugin/out_statsd.rb
99
+ - spec/plugin/multiple_placeholders_spec.rb
99
100
  - spec/plugin/out_statsd_spec.rb
100
101
  - spec/spec_helper.rb
101
102
  homepage: https://github.com/lingochamp/fluent-plugin-statsd
@@ -122,5 +123,6 @@ signing_key:
122
123
  specification_version: 4
123
124
  summary: fluentd output filter plugin to send metrics to Esty StatsD
124
125
  test_files:
126
+ - spec/plugin/multiple_placeholders_spec.rb
125
127
  - spec/plugin/out_statsd_spec.rb
126
128
  - spec/spec_helper.rb