fluent-plugin-influxdb 0.3.1 → 0.3.2

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: 659fc90e62fb688b58a1846586ac472afeea1930
4
- data.tar.gz: 90a268553b8597b8fa4a2501e06820870bdf4e4c
3
+ metadata.gz: 4afa2a9a824f0e8244f43a91388672bd3aeb5b37
4
+ data.tar.gz: 62b6862ca594e33baba91d1e636f99a25a46e03c
5
5
  SHA512:
6
- metadata.gz: df2e35733cc5a28310a4e77458cee98328b9ab10cebd7efcf34b61883a49f6b6336daa68b2729008a3c6588b3f34356754cfe1f3b6bb563fc9d3f57200917293
7
- data.tar.gz: 3977a6a8914bd8078d3c29d97daad7f7329d587600349008fd02ac81515df33611ad5d2bb9493cb4917a9062d612d7caf027a3736eb381310373169db4a04e1d
6
+ metadata.gz: 5130af21066c04c43b6513a90cd487ea5dd854631142e7aec926ad1a831d162f677ad10f45168bddad4fbb19d0fa87d327c6773540030a084ede0e89c2498c71
7
+ data.tar.gz: 023de58413a574403ef90656b440b7c21853aab89fef305d8348a6c420bfba4582f0e12a1b3d0665aab3e3f4456062790f188c2ce80cb228551d99540b8c0e4c
data/History.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.3.2 (Jan, 18, 2017)
5
+ =====
6
+
7
+ - Add measurement parameter
8
+
4
9
  0.3.1 (Jan, 07, 2017)
5
10
  =====
6
11
 
@@ -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-influxdb"
6
- s.version = '0.3.1'
6
+ s.version = '0.3.2'
7
7
  s.authors = ["Masahiro Nakagawa", "FangLi"]
8
8
  s.email = ["repeatedly@gmail.com", "surivlee@gmail.com"]
9
9
  s.description = %q{InfluxDB output plugin for Fluentd}
@@ -18,6 +18,8 @@ class Fluent::InfluxdbOutput < Fluent::BufferedOutput
18
18
  The database name of influxDB.
19
19
  You should create the database and grant permissions at first.
20
20
  DESC
21
+ config_param :measurement, :string, :default => nil,
22
+ :desc => "The measurement name to insert events. If not specified, fluentd's tag is used"
21
23
  config_param :user, :string, :default => 'root',
22
24
  :desc => "The DB user of influxDB, should be created manually."
23
25
  config_param :password, :string, :default => 'root', :secret => true,
@@ -142,7 +144,7 @@ DESC
142
144
 
143
145
  point = {
144
146
  :timestamp => timestamp,
145
- :series => tag,
147
+ :series => @measurement || tag,
146
148
  :values => values,
147
149
  :tags => tags,
148
150
  }
@@ -79,8 +79,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
79
79
  time = event_time('2011-01-02 13:14:15 UTC')
80
80
  driver.emit({'a' => 1}, time)
81
81
  driver.emit({'a' => 2}, time)
82
-
83
- data = driver.run
82
+ driver.run
84
83
 
85
84
  assert_equal([
86
85
  [
@@ -104,10 +103,44 @@ class InfluxdbOutputTest < Test::Unit::TestCase
104
103
  ], driver.instance.influxdb.points)
105
104
  end
106
105
 
106
+ def test_write_with_measurement
107
+ config_with_measurement = %Q(
108
+ #{CONFIG}
109
+ measurement test
110
+ )
111
+
112
+ driver = create_driver(config_with_measurement, 'input.influxdb')
113
+
114
+ time = event_time('2011-01-02 13:14:15 UTC')
115
+ driver.emit({'a' => 1}, time)
116
+ driver.emit({'a' => 2}, time)
117
+ driver.run
118
+
119
+ assert_equal([
120
+ [
121
+ [
122
+ {
123
+ :timestamp => time,
124
+ :series => 'test',
125
+ :tags => {},
126
+ :values => {'a' => 1}
127
+ },
128
+ {
129
+ :timestamp => time,
130
+ :series => 'test',
131
+ :tags => {},
132
+ :values => {'a' => 2}
133
+ },
134
+ ],
135
+ nil,
136
+ nil
137
+ ]
138
+ ], driver.instance.influxdb.points)
139
+ end
140
+
107
141
  def test_empty_tag_keys
108
142
  config_with_tags = %Q(
109
143
  #{CONFIG}
110
-
111
144
  tag_keys ["b"]
112
145
  )
113
146
 
@@ -118,7 +151,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
118
151
  driver.emit({'a' => 2, 'b' => 1}, time)
119
152
  driver.emit({'a' => 3, 'b' => ' '}, time)
120
153
 
121
- data = driver.run
154
+ driver.run
122
155
 
123
156
  assert_equal([
124
157
  [
@@ -147,8 +180,8 @@ class InfluxdbOutputTest < Test::Unit::TestCase
147
180
  ]
148
181
  ], driver.instance.influxdb.points)
149
182
  end
150
-
151
- def test_auto_tagging
183
+
184
+ def test_auto_tagging
152
185
  config_with_tags = %Q(
153
186
  #{CONFIG}
154
187
 
@@ -162,9 +195,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
162
195
  driver.emit({'a' => 2, 'b' => 1}, time)
163
196
  driver.emit({'a' => 3, 'b' => ' '}, time)
164
197
 
165
-
166
- data = driver.run
167
-
198
+ driver.run
168
199
  assert_equal([
169
200
  [
170
201
  [
@@ -193,9 +224,9 @@ class InfluxdbOutputTest < Test::Unit::TestCase
193
224
  nil
194
225
  ]
195
226
  ], driver.instance.influxdb.points)
196
- end
227
+ end
197
228
 
198
- def test_ignore_empty_values
229
+ def test_ignore_empty_values
199
230
  config_with_tags = %Q(
200
231
  #{CONFIG}
201
232
 
@@ -208,8 +239,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
208
239
  driver.emit({'b' => '3'}, time)
209
240
  driver.emit({'a' => 2, 'b' => 1}, time)
210
241
 
211
- data = driver.run
212
-
242
+ driver.run
213
243
  assert_equal([
214
244
  [
215
245
  [
@@ -249,8 +279,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
249
279
  driver.emit({'a' => 1}, time2)
250
280
  driver.emit({'a' => 2}, time2)
251
281
 
252
- data = driver.run
253
-
282
+ driver.run
254
283
  assert_equal([
255
284
  [
256
285
  [
@@ -296,8 +325,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
296
325
  driver.emit({'a' => 1}, time)
297
326
  driver.emit({'a' => 2}, time)
298
327
 
299
- data = driver.run
300
-
328
+ driver.run
301
329
  assert_equal([
302
330
  [
303
331
  [
@@ -332,8 +360,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
332
360
  driver.emit({'a' => 2, 'rp' => 'ephemeral_1d'}, time)
333
361
  driver.emit({'a' => 3, 'rp' => 'ephemeral_1m'}, time)
334
362
 
335
- data = driver.run
336
-
363
+ driver.run
337
364
  assert_equal([
338
365
  [
339
366
  [
@@ -388,8 +415,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
388
415
  driver.emit({'a' => 3, 'rp' => 'ephemeral_1m'}, time)
389
416
  driver.emit({'a' => 4}, time)
390
417
 
391
- data = driver.run
392
-
418
+ driver.run
393
419
  assert_equal([
394
420
  [
395
421
  [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-influxdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-07 00:00:00.000000000 Z
12
+ date: 2017-01-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.5.1
128
+ rubygems_version: 2.6.8
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: A buffered output plugin for fluentd and influxDB