fluent-plugin-yohoushi 0.0.2 → 0.0.3

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: 0260b396f8e546b3fbac8d17c8c54b2bf99d9c91
4
- data.tar.gz: 580c25d8ae8a7b074ba6d77c64386a03f8cbb013
3
+ metadata.gz: e999a6aedf4bd3f07f2a40298b9826da39a5dd68
4
+ data.tar.gz: abd025986465c4ee61f437f656a2439c6f12d3d0
5
5
  SHA512:
6
- metadata.gz: 2a55115383e3167ce00babc0c5463fc88027ba7e77fc26435258eb9b645ef51669bed1a4060db1bfeee23a37711c8c65edddab556c26b29f1c601233ccf1277e
7
- data.tar.gz: c060c70279ec0b3fa27637af816b8caa05ebe328511064dfc2280660a030fc64f02186fb3983ee2e2871366fae92a9e590805071fc5005c8a6bb0f5435b3b53c
6
+ metadata.gz: 7ba26bb0f27b83ac24b059e24989e12097b5cf8e5f50b039da0059e85952856820c5082f5d474fd1767180fa27363be9e553c7af308987ab2a5779a544d8954c
7
+ data.tar.gz: 48f200e029d13f71655c13bf18301616aa80eb66ce69c289a0af0f199e7542a902e641eebb013c9458f406180279fd3c3c9b2dfc495d2f78bcb705114f080f76
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.0.3 (2013/12/12)
2
+
3
+ Changes:
4
+
5
+ * Rename ${tags} placeholders to ${tag\_parts} placeholder to support plugin standard (see fluent-plugin-record-reformer, fluent-plugin-rewrite-tag-filter)
6
+
1
7
  ## 0.0.2 (2013/12/12)
2
8
 
3
9
  Enhancement:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # fluent-plugin-yohoushi [![Build Status](https://secure.travis-ci.org/sonots/fluent-plugin-yohoushi.png?branch=master)](http://travis-ci.org/sonots/fluent-plugin-yohoushi) [![Dependency Status](https://gemnasium.com/sonots/fluent-plugin-yohoushi.png)](https://gemnasium.com/sonots/fluent-plugin-yohoushi)
1
+ # fluent-plugin-yohoushi [![Build Status](https://secure.travis-ci.org/yohoushi/fluent-plugin-yohoushi.png?branch=master)](http://travis-ci.org/sonots/fluent-plugin-yohoushi) [![Dependency Status](https://gemnasium.com/yohoushi/fluent-plugin-yohoushi.png)](https://gemnasium.com/yohoushi/fluent-plugin-yohoushi)
2
2
 
3
3
  Fluentd plugin to post data to yohoushi where [yohoushi](http://yohoushi.github.io/yohoushi/) is a visualization graph tool.
4
4
 
@@ -77,14 +77,15 @@ shall be available. In addition, following placeholders are reserved:
77
77
 
78
78
  * ${hostname} hostname
79
79
  * ${tag} input tag
80
- * ${tags} input tag splitted by '.'
80
+ * ${tag\_parts} input tag splitted by '.'
81
+ * ${tags} input tag splitted by '.' (obsolete)
81
82
  * ${time} time of the event
82
83
  * ${key} the matched key value with `key_pattern` or `key1`, `key2`, ...
83
84
 
84
85
  It is also possible to write a ruby code in placeholders, so you may write some codes as
85
86
 
86
87
  * ${time.strftime('%Y-%m-%dT%H:%M:%S%z')}
87
- * ${tags.last}
88
+ * ${tag\_parts.last}
88
89
 
89
90
  ## ChangeLog
90
91
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-yohoushi"
6
- s.version = "0.0.2"
6
+ s.version = "0.0.3"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-yohoushi"
@@ -94,12 +94,12 @@ class Fluent::YohoushiOutput < Fluent::Output
94
94
  end
95
95
 
96
96
  def emit(tag, es, chain)
97
- tags = tag.split('.')
97
+ tag_parts = tag.split('.')
98
98
  if @key_pattern
99
99
  es.each do |time, record|
100
100
  record.each do |key, value|
101
101
  next unless key =~ @key_pattern
102
- path = expand_placeholder(@key_pattern_path, record, tag, tags, time, key)
102
+ path = expand_placeholder(@key_pattern_path, record, tag, tag_parts, time, key)
103
103
  post(path, value)
104
104
  end
105
105
  end
@@ -107,7 +107,7 @@ class Fluent::YohoushiOutput < Fluent::Output
107
107
  es.each do |time, record|
108
108
  @keys.each do |key, path|
109
109
  next unless value = record[key]
110
- path = expand_placeholder(path, record, tag, tags, time, key)
110
+ path = expand_placeholder(path, record, tag, tag_parts, time, key)
111
111
  post(path, value)
112
112
  end
113
113
  end
@@ -118,12 +118,11 @@ class Fluent::YohoushiOutput < Fluent::Output
118
118
  $log.warn "out_yohoushi: #{e.class} #{e.message} #{e.backtrace.first}"
119
119
  end
120
120
 
121
- private
122
-
123
- def expand_placeholder(str, record, tag, tags, time, key)
121
+ def expand_placeholder(str, record, tag, tag_parts, time, key)
124
122
  struct = UndefOpenStruct.new(record)
125
123
  struct.tag = tag
126
- struct.tags = tags
124
+ struct.tags = tag_parts # obsolete
125
+ struct.tag_parts = tag_parts
127
126
  struct.time = time
128
127
  struct.key = key
129
128
  struct.hostname = @hostname
@@ -20,6 +20,7 @@ describe Fluent::YohoushiOutput do
20
20
  let(:growthforecast_base_uri) { 'http://localhost:5125' }
21
21
  let(:tag) { 'test' }
22
22
  let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::YohoushiOutput, tag).configure(config) }
23
+ let(:instance) { driver.instance }
23
24
  let(:emit) { driver.run { messages.each {|message| driver.emit(message, time) } } }
24
25
 
25
26
  describe 'test configure' do
@@ -137,4 +138,22 @@ describe Fluent::YohoushiOutput do
137
138
  it { emit }
138
139
  end
139
140
  end
141
+
142
+ describe 'expand_placeholder' do
143
+ let(:config) { %[mapping1 / http://foo\nkey1 foo bar] }
144
+ let(:tag) { 'fluent.error' }
145
+ let(:record) { { 'foo_count' => "1", 'bar_count' => "1" } }
146
+ let(:tag_parts) { tag.split('.') }
147
+ let(:time) { Time.now.to_i }
148
+
149
+ context 'tags (obsolete)' do
150
+ let(:path) { '/path/to/${tags[-1]}' }
151
+ it { instance.expand_placeholder(path, record, tag, tag_parts, time, 'foo_count').should == '/path/to/error' }
152
+ end
153
+
154
+ context 'tag_parts' do
155
+ let(:path) { '/path/to/${tag_parts[-1]}' }
156
+ it { instance.expand_placeholder(path, record, tag, tag_parts, time, 'foo_count').should == '/path/to/error' }
157
+ end
158
+ end
140
159
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-yohoushi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-12 00:00:00.000000000 Z
11
+ date: 2013-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project: fluent-plugin-yohoushi
151
- rubygems_version: 2.1.10
151
+ rubygems_version: 2.0.3
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: fluentd plugin to post data to yohoushi