fluent-plugin-influxdb-v2 1.8.0.pre.1021 → 1.9.0.pre.1209

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: 5a184ab7f5812ee9974db610247187bbca47080079f3ffb610b535797b28d1c5
4
- data.tar.gz: 97fbf1e06efc6728673cbd2e35f5a2ef5639e54fa09e0fa260b811810dd0dc73
3
+ metadata.gz: b407d41fb5654f68fb0e20c644516d23ae03d8cd20ee1782d48915d464f21592
4
+ data.tar.gz: 6e643a4848081996dea34367949a362da8ed96f65ebe82ecd28091f91e148729
5
5
  SHA512:
6
- metadata.gz: 86004d977d07877bf268fa1b79f4645c396ca10be5c4474dbacc8c81cc43aa87a236b218424906f3f452f210aa9f6d5ab0aef710dffe7e978773b853fe29649c
7
- data.tar.gz: 8bf932e88c5fbfb30451f8f807cf1f9ae0275a7cd8089d9379aee09538e080563b95ea281e200932add3efeb62c619f2a5cbff620b99c46f605fd6d3e1f28207
6
+ metadata.gz: 5458e096b8c9375095056f367451f4fb681a642776d622bd1e6536674c67bd9f8d823c007330d2806a0dd64be9f970014d9b01c59370ba3b4f3eaaa9e47a725f
7
+ data.tar.gz: dadf7c323827adaac002f3d8f094150e92e6bb861e33299585d45f2b46704c91622e19ee31163ba6644c5e9d6cd9bacf1e11c50d1d4bd357e1c8d27596341110
data/.circleci/config.yml CHANGED
@@ -41,9 +41,9 @@ commands:
41
41
  - restore_cache:
42
42
  name: Restoring Gem Cache
43
43
  keys:
44
- - &cache-key gem-cache-{{ checksum "fluent-plugin-influxdb-v2.gemspec" }}-<< parameters.ruby-image >>
45
- - gem-cache-{{ checksum "fluent-plugin-influxdb-v2.gemspec" }}
46
- - gem-cache-
44
+ - &cache-key gem-cache-v2-{{ checksum "fluent-plugin-influxdb-v2.gemspec" }}-<< parameters.ruby-image >>
45
+ - gem-cache-v2-{{ checksum "fluent-plugin-influxdb-v2.gemspec" }}
46
+ - gem-cache-v2-
47
47
  - run:
48
48
  name: Install dependencies
49
49
  command: |
@@ -75,7 +75,7 @@ jobs:
75
75
  parameters:
76
76
  ruby-image:
77
77
  type: string
78
- default: &default-ruby-image "circleci/ruby:2.6-stretch"
78
+ default: &default-ruby-image "cimg/ruby:2.6"
79
79
  influxdb-image:
80
80
  type: string
81
81
  default: &default-influxdb-image "influxdb:latest"
@@ -119,7 +119,7 @@ workflows:
119
119
  jobs:
120
120
  - tests-ruby:
121
121
  name: ruby-2.7
122
- ruby-image: "circleci/ruby:2.7-buster"
122
+ ruby-image: "cimg/ruby:2.7"
123
123
  - tests-ruby:
124
124
  name: ruby-2.6
125
125
  - tests-ruby:
@@ -127,10 +127,10 @@ workflows:
127
127
  influxdb-image: "quay.io/influxdb/influxdb:nightly"
128
128
  - tests-ruby:
129
129
  name: ruby-2.5
130
- ruby-image: "circleci/ruby:2.5-stretch"
130
+ ruby-image: "cimg/ruby:2.5"
131
131
  - tests-ruby:
132
132
  name: ruby-2.4
133
- ruby-image: "circleci/ruby:2.4-stretch"
133
+ ruby-image: "cimg/ruby:2.4"
134
134
  - deploy-preview:
135
135
  requires:
136
136
  - ruby-2.7
data/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
- ## 1.8.0 [unreleased]
1
+ ## 1.9.0 [unreleased]
2
+
3
+ ### CI
4
+ 1. [#27](https://github.com/influxdata/influxdb-plugin-fluent/pull/27): Switch to next-gen CircleCI's convenience images
5
+
6
+ ## 1.8.0 [2021-08-20]
7
+
8
+ ### Features
9
+ 1. [#26](https://github.com/influxdata/influxdb-plugin-fluent/pull/26): Add placeholder support for bucket & measurement fields
2
10
 
3
11
  ## 1.7.0 [2021-03-05]
4
12
 
5
13
  ### Features
6
- 1. [#23](https://github.com/influxdata/influxdb-plugin-fluent/pull/23): Added possibility to specify the certification verification behaviour
14
+ 1. [#23](https://github.com/influxdata/influxdb-plugin-fluent/pull/23): Add possibility to specify the certification verification behaviour
7
15
 
8
16
  ### CI
9
- 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`
17
+ 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`
10
18
 
11
19
  ## 1.6.0 [2020-10-02]
12
20
 
@@ -18,7 +26,7 @@
18
26
 
19
27
  ## 1.5.0 [2020-07-17]
20
28
 
21
- 1. [#12](https://github.com/influxdata/influxdb-plugin-fluent/pull/12): Renamed gem to `fluent-plugin-influxdb-v2`
29
+ 1. [#12](https://github.com/influxdata/influxdb-plugin-fluent/pull/12): Rename gem to `fluent-plugin-influxdb-v2`
22
30
 
23
31
  ### Dependencies
24
32
  1. [#11](https://github.com/influxdata/influxdb-plugin-fluent/pull/11): Upgrade InfluxDB client to 1.6.0
@@ -26,7 +34,7 @@
26
34
  ## 1.4.0 [2020-06-19]
27
35
 
28
36
  ### Features
29
- 1. [#8](https://github.com/influxdata/influxdb-plugin-fluent/pull/8): Added support for nested fields
37
+ 1. [#8](https://github.com/influxdata/influxdb-plugin-fluent/pull/8): Add support for nested fields
30
38
 
31
39
  ### Dependencies
32
40
  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.7.0
22
+ fluent-gem install fluent-plugin-influxdb-v2 -v 1.8.0
23
23
  ```
24
24
 
25
25
  ## Plugins
@@ -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.8.0'.freeze
24
+ VERSION = '1.9.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.8.0.pre.1021
4
+ version: 1.9.0.pre.1209
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-04-16 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -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.1
229
+ rubygems_version: 3.2.22
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: InfluxDB 2 output plugin for Fluentd