fluent-plugin-influxdb-v2 1.7.0.pre.960 → 1.8.0.pre.1156

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
  SHA256:
3
- metadata.gz: 8e1bf6d4d8064ef174bbb91426340735a27f779f259ad3262886b90f6f3e3e88
4
- data.tar.gz: 27f9fbc7cca9d2a9b86b8fcf533c4fe582e9f1014f960f10cb15edca80186c60
3
+ metadata.gz: 1c4a018e78cb9e91efa9f1c46135c7196ac33b5ea7583596c8aad432a3a8e2cc
4
+ data.tar.gz: e8a9499c446e0b428bf1b1d36ea1530c018fca4eb3c80bffbc2a228919e17da5
5
5
  SHA512:
6
- metadata.gz: 8ae1dd318e5ccd2a79902eb45f73a17a3238556e3cd0aa7b9e1e7f2c694c72d992d54a3f49eb65b9f0cee6c2df768b005372475ec50021c0eef882440c412dd2
7
- data.tar.gz: 58253e1b90ea7642db64f9ce278ef00be20defffc6fbb007836a1c7eadfd6d48c81c532b4088c901e0975310c22f682e26c2387d3ac953c2bb6148ef8cb45160
6
+ metadata.gz: e9e67f6fa6fd3a0709da0261ba970de037097d6d90cb9971df55acc21f3dc57ea8a1273a4ed6f2c2d7773ca1b32298fa6e97b1a2f303d5ea199030458bce3f04
7
+ data.tar.gz: b48d5a01cbd5841d0fc9df6fe039369d30696392815082c6aa0c249129088117423b0233c17e5be05a5fcfec25acb4f3d4dbf5dcabe37c146aecae1cdcdc4413
data/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
- ## 1.7.0 [unreleased]
1
+ ## 1.8.0 [unreleased]
2
2
 
3
3
  ### Features
4
- 1. [#23](https://github.com/influxdata/influxdb-plugin-fluent/pull/23): Added possibility to specify the certification verification behaviour
4
+ 1. [#26](https://github.com/influxdata/influxdb-plugin-fluent/pull/26): Add placeholder support for bucket & measurement fields
5
+
6
+ ## 1.7.0 [2021-03-05]
7
+
8
+ ### Features
9
+ 1. [#23](https://github.com/influxdata/influxdb-plugin-fluent/pull/23): Add possibility to specify the certification verification behaviour
5
10
 
6
11
  ### CI
7
- 1. [#24](https://github.com/influxdata/influxdb-plugin-fluent/pull/24): Updated stable image to `influxdb:latest` and nightly to `quay.io/influxdb/influxdb:nightly`
12
+ 1. [#24](https://github.com/influxdata/influxdb-plugin-fluent/pull/24): Updat stable image to `influxdb:latest` and nightly to `quay.io/influxdb/influxdb:nightly`
8
13
 
9
14
  ## 1.6.0 [2020-10-02]
10
15
 
@@ -16,7 +21,7 @@
16
21
 
17
22
  ## 1.5.0 [2020-07-17]
18
23
 
19
- 1. [#12](https://github.com/influxdata/influxdb-plugin-fluent/pull/12): Renamed gem to `fluent-plugin-influxdb-v2`
24
+ 1. [#12](https://github.com/influxdata/influxdb-plugin-fluent/pull/12): Rename gem to `fluent-plugin-influxdb-v2`
20
25
 
21
26
  ### Dependencies
22
27
  1. [#11](https://github.com/influxdata/influxdb-plugin-fluent/pull/11): Upgrade InfluxDB client to 1.6.0
@@ -24,7 +29,7 @@
24
29
  ## 1.4.0 [2020-06-19]
25
30
 
26
31
  ### Features
27
- 1. [#8](https://github.com/influxdata/influxdb-plugin-fluent/pull/8): Added support for nested fields
32
+ 1. [#8](https://github.com/influxdata/influxdb-plugin-fluent/pull/8): Add support for nested fields
28
33
 
29
34
  ### Dependencies
30
35
  1. [#9](https://github.com/influxdata/influxdb-plugin-fluent/pull/9): Upgrade InfluxDB client to 1.5.0
data/README.md CHANGED
@@ -19,7 +19,7 @@ This repository contains the reference Fluentd plugin for the InfluxDB 2.0.
19
19
  The plugin is bundled as a gem and is hosted on [Rubygems](https://rubygems.org/gems/fluent-plugin-influxdb-v2). You can install the gem as follows:
20
20
 
21
21
  ```
22
- fluent-gem install fluent-plugin-influxdb-v2 -v 1.6.0
22
+ fluent-gem install fluent-plugin-influxdb-v2 -v 1.7.0
23
23
  ```
24
24
 
25
25
  ## Plugins
@@ -47,8 +47,7 @@ Gem::Specification.new do |spec|
47
47
  spec.required_ruby_version = '>= 2.2.0'
48
48
 
49
49
  spec.add_runtime_dependency 'fluentd', '~> 1.8'
50
- # Temporary depends to prerelease version - will be change to 1.12.0 after release the client
51
- spec.add_runtime_dependency 'influxdb-client', '1.12.0.pre.1894'
50
+ spec.add_runtime_dependency 'influxdb-client', '1.12.0'
52
51
 
53
52
  spec.add_development_dependency 'bundler', '~> 2.0'
54
53
  spec.add_development_dependency 'codecov', '~> 0.1.16'
@@ -119,7 +119,7 @@ class InfluxDBOutput < Fluent::Plugin::Output
119
119
  def write(chunk)
120
120
  points = []
121
121
  tag = chunk.metadata.tag
122
- measurement = @measurement || tag
122
+ bucket, measurement = expand_placeholders(chunk)
123
123
  chunk.msgpack_each do |time, record|
124
124
  if time.is_a?(Integer)
125
125
  time_formatted = time
@@ -141,12 +141,22 @@ class InfluxDBOutput < Fluent::Plugin::Output
141
141
  point.time(time_formatted, @precision)
142
142
  points << point
143
143
  end
144
- @write_api.write(data: points)
144
+ @write_api.write(data: points, bucket: bucket)
145
145
  log.debug "Written points: #{points}"
146
146
  end
147
147
 
148
148
  private
149
149
 
150
+ def expand_placeholders(chunk)
151
+ bucket = extract_placeholders(@bucket, chunk)
152
+ measurement = if @measurement
153
+ extract_placeholders(@measurement, chunk)
154
+ else
155
+ chunk.metadata.tag
156
+ end
157
+ [bucket, measurement]
158
+ end
159
+
150
160
  def _parse_field(key, value, point)
151
161
  if @tag_keys.include?(key)
152
162
  point.add_tag(key, value)
@@ -21,7 +21,7 @@
21
21
  module InfluxDB2
22
22
  module Plugin
23
23
  module Fluent
24
- VERSION = '1.7.0'.freeze
24
+ VERSION = '1.8.0'.freeze
25
25
  end
26
26
  end
27
27
  end
@@ -475,4 +475,39 @@ class InfluxDBOutputTest < Minitest::Test
475
475
  driver.feed(time, data)
476
476
  time
477
477
  end
478
+
479
+ def test_bucket_as_placeholder
480
+ stub_request(:any, 'https://localhost:8086/api/v2/write?bucket=placeholder_h2o_tag&org=my-org&precision=ns')
481
+ .to_return(status: 204)
482
+ driver = create_driver(%(
483
+ @type influxdb2
484
+ token my-token
485
+ bucket placeholder_${tag}
486
+ org my-org
487
+ time_precision ns
488
+ ))
489
+ driver.run(default_tag: 'h2o_tag') do
490
+ emit_documents(driver)
491
+ end
492
+ assert_requested(:post, 'https://localhost:8086/api/v2/write?bucket=placeholder_h2o_tag&org=my-org&precision=ns',
493
+ times: 1, body: 'h2o_tag level=2i,location="europe" 1444897215000000000')
494
+ end
495
+
496
+ def test_measurement_as_placeholder
497
+ stub_request(:any, 'https://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
498
+ .to_return(status: 204)
499
+ driver = create_driver(%(
500
+ @type influxdb2
501
+ token my-token
502
+ bucket my-bucket
503
+ org my-org
504
+ time_precision ns
505
+ measurement placeholder_${tag}
506
+ ))
507
+ driver.run(default_tag: 'h2o_tag') do
508
+ emit_documents(driver)
509
+ end
510
+ assert_requested(:post, 'https://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
511
+ times: 1, body: 'placeholder_h2o_tag level=2i,location="europe" 1444897215000000000')
512
+ end
478
513
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-influxdb-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0.pre.960
4
+ version: 1.8.0.pre.1156
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.12.0.pre.1894
33
+ version: 1.12.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.12.0.pre.1894
40
+ version: 1.12.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: 1.3.1
228
228
  requirements: []
229
- rubygems_version: 3.0.3
229
+ rubygems_version: 3.0.3.1
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: InfluxDB 2 output plugin for Fluentd