fluent-plugin-influxdb 0.3.3 → 1.0.0.rc1
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 +4 -4
- data/History.md +0 -5
- data/README.md +15 -1
- data/Rakefile +1 -1
- data/fluent-plugin-influxdb.gemspec +2 -2
- data/lib/fluent/plugin/out_influxdb.rb +59 -42
- data/test/helper.rb +1 -0
- data/test/plugin/test_out_influxdb.rb +190 -153
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd442a71e13241ba8c98b176ecc4a54566acc145
|
4
|
+
data.tar.gz: 3a6d9849679dbfc8de623ca602f45d2bcf49f8f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cebcb1e5e0428f0c3a3ed718a8ec42e18d62e98afb993c05ebf9ff5599d127ffe4cfa02aa4eb3fe69055a19e3bcc6233e7d86e64c119723677e913b6847b06f3
|
7
|
+
data.tar.gz: 34a9a7e5b91320af2df3070d97c1b57cd06a956d6f938cd551d5ccc3f0ea39f53512bbe1a3e5cb8718da09354db79c1f6c6d8310bce61863b14056ca2efbfd42
|
data/History.md
CHANGED
data/README.md
CHANGED
@@ -9,9 +9,19 @@ If you are using fluentd as a collector and want to organize your time-series da
|
|
9
9
|
This version uses influxdb-ruby version 0.2.0 which no longer supports InfluxDB version 0.8 (which is also deprecated).
|
10
10
|
If you are using InfluxDB version 0.8 please specify version 0.1.8 of this plugin.
|
11
11
|
|
12
|
+
## Requirements
|
13
|
+
|
14
|
+
| fluent-plugin-influxdb | fluentd | ruby |
|
15
|
+
|------------------------|---------|------|
|
16
|
+
| >= 1.0.0 | >= v0.14.0 | >= 2.1 |
|
17
|
+
| < 1.0.0 | >= v0.12.0 | >= 1.9 |
|
18
|
+
|
19
|
+
NOTE: fluent-plugin-influxdb v1.0.0 is now RC. We will release stable v1.0.0 soon.
|
20
|
+
|
12
21
|
## Installation
|
13
22
|
|
14
|
-
$ fluent-gem install fluent-plugin-influxdb
|
23
|
+
$ fluent-gem install fluent-plugin-influxdb -v "~> 0.3" --no-document # for fluentd v0.12 or later
|
24
|
+
$ fluent-gem install fluent-plugin-influxdb -v 1.0.0.rc1 --no-document # for fluentd v0.14 or later
|
15
25
|
|
16
26
|
### Ruby 2.0 or earlier
|
17
27
|
|
@@ -37,6 +47,8 @@ Just like other regular output plugins, Use type `influxdb` in your fluentd conf
|
|
37
47
|
|
38
48
|
`dbname`: The database name of influxDB, default to "fluentd". you should create the database and grant permissions first
|
39
49
|
|
50
|
+
`measurement`: The measurement/serise for record insertion. The default is nil.
|
51
|
+
|
40
52
|
`user`: The DB user of influxDB, should be created manually, default to "root"
|
41
53
|
|
42
54
|
`password`: The password of the user, default to "root"
|
@@ -66,6 +78,8 @@ Just like other regular output plugins, Use type `influxdb` in your fluentd conf
|
|
66
78
|
influxdb plugin uses Fluentd event tag for InfluxDB series.
|
67
79
|
So if you have events with `app.event`, influxdb plugin inserts events into `app.event` series in InfluxDB.
|
68
80
|
|
81
|
+
If you set `measurement` parameter, use its value instead of event tag.
|
82
|
+
|
69
83
|
## Configuration Example
|
70
84
|
|
71
85
|
```
|
data/Rakefile
CHANGED
@@ -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.
|
6
|
+
s.version = '1.0.0.rc1'
|
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}
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
19
|
s.add_runtime_dependency "fluentd", [">= 0.10.49", "< 2"]
|
20
|
-
s.add_runtime_dependency "influxdb",
|
20
|
+
s.add_runtime_dependency "influxdb", ">= 0.2.0"
|
21
21
|
|
22
22
|
s.add_development_dependency "rake"
|
23
23
|
s.add_development_dependency "pry"
|
@@ -1,57 +1,63 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'date'
|
3
3
|
require 'influxdb'
|
4
|
-
require 'fluent/output'
|
4
|
+
require 'fluent/plugin/output'
|
5
5
|
require 'fluent/mixin'
|
6
6
|
|
7
|
-
class Fluent::InfluxdbOutput < Fluent::
|
7
|
+
class Fluent::Plugin::InfluxdbOutput < Fluent::Plugin::Output
|
8
8
|
Fluent::Plugin.register_output('influxdb', self)
|
9
9
|
|
10
|
-
|
10
|
+
helpers :compat_parameters
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
config_param :
|
15
|
-
:
|
16
|
-
config_param :
|
17
|
-
:
|
12
|
+
DEFAULT_BUFFER_TYPE = "memory"
|
13
|
+
|
14
|
+
config_param :host, :string, default: 'localhost',
|
15
|
+
desc: "The IP or domain of influxDB, separate with comma."
|
16
|
+
config_param :port, :integer, default: 8086,
|
17
|
+
desc: "The HTTP port of influxDB."
|
18
|
+
config_param :dbname, :string, default: 'fluentd',
|
19
|
+
desc: <<-DESC
|
18
20
|
The database name of influxDB.
|
19
21
|
You should create the database and grant permissions at first.
|
20
22
|
DESC
|
21
|
-
config_param :measurement, :string, :
|
22
|
-
:
|
23
|
-
config_param :user, :string, :
|
24
|
-
:
|
25
|
-
config_param :password, :string, :
|
26
|
-
:
|
27
|
-
config_param :retry, :integer, :
|
28
|
-
:
|
29
|
-
config_param :time_key, :string, :
|
30
|
-
:
|
31
|
-
config_param :time_precision, :string, :
|
32
|
-
:
|
23
|
+
config_param :measurement, :string, default: nil,
|
24
|
+
desc: "The measurement name to insert events. If not specified, fluentd's tag is used"
|
25
|
+
config_param :user, :string, default: 'root',
|
26
|
+
desc: "The DB user of influxDB, should be created manually."
|
27
|
+
config_param :password, :string, default: 'root', secret: true,
|
28
|
+
desc: "The password of the user."
|
29
|
+
config_param :retry, :integer, default: nil,
|
30
|
+
desc: 'The finite number of retry times. default is infinite'
|
31
|
+
config_param :time_key, :string, default: 'time',
|
32
|
+
desc: 'Use value of this tag if it exists in event instead of event timestamp'
|
33
|
+
config_param :time_precision, :string, default: 's',
|
34
|
+
desc: <<-DESC
|
33
35
|
The time precision of timestamp.
|
34
36
|
You should specify either hour (h), minutes (m), second (s),
|
35
37
|
millisecond (ms), microsecond (u), or nanosecond (ns).
|
36
38
|
DESC
|
37
|
-
config_param :use_ssl, :bool, :
|
38
|
-
:
|
39
|
-
config_param :verify_ssl, :bool, :
|
40
|
-
:
|
41
|
-
config_param :auto_tags, :bool, :
|
42
|
-
:
|
43
|
-
config_param :tag_keys, :array, :
|
44
|
-
:
|
45
|
-
config_param :sequence_tag, :string, :
|
46
|
-
:
|
39
|
+
config_param :use_ssl, :bool, default: false,
|
40
|
+
desc: "Use SSL when connecting to influxDB."
|
41
|
+
config_param :verify_ssl, :bool, default: true,
|
42
|
+
desc: "Enable/Disable SSL Certs verification when connecting to influxDB via SSL."
|
43
|
+
config_param :auto_tags, :bool, default: false,
|
44
|
+
desc: "Enable/Disable auto-tagging behaviour which makes strings tags."
|
45
|
+
config_param :tag_keys, :array, default: [],
|
46
|
+
desc: "The names of the keys to use as influxDB tags."
|
47
|
+
config_param :sequence_tag, :string, default: nil,
|
48
|
+
desc: <<-DESC
|
47
49
|
The name of the tag whose value is incremented for the consecutive simultaneous
|
48
50
|
events and reset to zero for a new event with the different timestamp.
|
49
51
|
DESC
|
50
|
-
config_param :retention_policy_key, :string, :
|
51
|
-
:
|
52
|
-
config_param :default_retention_policy, :string, :
|
53
|
-
:
|
54
|
-
|
52
|
+
config_param :retention_policy_key, :string, default: nil,
|
53
|
+
desc: "The key of the key in the record that stores the retention policy name"
|
54
|
+
config_param :default_retention_policy, :string, default: nil,
|
55
|
+
desc: "The name of the default retention policy"
|
56
|
+
|
57
|
+
config_section :buffer do
|
58
|
+
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
59
|
+
config_set_default :chunk_keys, ['tag']
|
60
|
+
end
|
55
61
|
|
56
62
|
def initialize
|
57
63
|
super
|
@@ -60,8 +66,10 @@ DESC
|
|
60
66
|
end
|
61
67
|
|
62
68
|
def configure(conf)
|
69
|
+
compat_parameters_convert(conf, :buffer)
|
63
70
|
super
|
64
71
|
@time_precise = time_precise_lambda()
|
72
|
+
raise Fluent::ConfigError, "'tag' in chunk_keys is required." if not @chunk_key_tag
|
65
73
|
end
|
66
74
|
|
67
75
|
def start
|
@@ -97,7 +105,7 @@ DESC
|
|
97
105
|
if record.empty? || record.has_value?(nil)
|
98
106
|
FORMATTED_RESULT_FOR_INVALID_RECORD
|
99
107
|
else
|
100
|
-
[
|
108
|
+
[precision_time(time), record].to_msgpack
|
101
109
|
end
|
102
110
|
end
|
103
111
|
|
@@ -106,9 +114,18 @@ DESC
|
|
106
114
|
@influxdb.stop!
|
107
115
|
end
|
108
116
|
|
117
|
+
def formatted_to_msgpack_binary
|
118
|
+
true
|
119
|
+
end
|
120
|
+
|
121
|
+
def multi_workers_ready?
|
122
|
+
true
|
123
|
+
end
|
124
|
+
|
109
125
|
def write(chunk)
|
110
126
|
points = []
|
111
|
-
chunk.
|
127
|
+
tag = chunk.metadata.tag
|
128
|
+
chunk.msgpack_each do |time, record|
|
112
129
|
timestamp = record.delete(@time_key) || time
|
113
130
|
if tag_keys.empty? && !@auto_tags
|
114
131
|
values = record
|
@@ -143,10 +160,10 @@ DESC
|
|
143
160
|
end
|
144
161
|
|
145
162
|
point = {
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
163
|
+
timestamp: timestamp,
|
164
|
+
series: @measurement || tag,
|
165
|
+
values: values,
|
166
|
+
tags: tags,
|
150
167
|
}
|
151
168
|
retention_policy = @default_retention_policy
|
152
169
|
unless @retention_policy_key.nil?
|
data/test/helper.rb
CHANGED
@@ -14,6 +14,7 @@ require 'test/unit'
|
|
14
14
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
15
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
16
16
|
require 'fluent/test'
|
17
|
+
require 'fluent/test/driver/output'
|
17
18
|
unless ENV.has_key?('VERBOSE')
|
18
19
|
nulllogger = Object.new
|
19
20
|
nulllogger.instance_eval {|obj|
|
@@ -20,6 +20,26 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
class DummyInfluxdbOutput < Fluent::Plugin::InfluxdbOutput
|
24
|
+
attr_reader :influxdb
|
25
|
+
def configure(conf)
|
26
|
+
@influxdb = DummyInfluxDBClient.new()
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def format(tag, time, record)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def formatted_to_msgpack_binary
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
38
|
+
def write(chunk)
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
23
43
|
def setup
|
24
44
|
Fluent::Test.setup
|
25
45
|
end
|
@@ -35,18 +55,12 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
35
55
|
time_precision s
|
36
56
|
]
|
37
57
|
|
38
|
-
def create_raw_driver(conf=CONFIG
|
39
|
-
Fluent::Test::
|
58
|
+
def create_raw_driver(conf=CONFIG)
|
59
|
+
Fluent::Test::Driver::Output.new(Fluent::Plugin::InfluxdbOutput).configure(conf)
|
40
60
|
end
|
41
61
|
|
42
|
-
def create_driver(conf=CONFIG
|
43
|
-
Fluent::Test::
|
44
|
-
attr_reader :influxdb
|
45
|
-
def configure(conf)
|
46
|
-
@influxdb = DummyInfluxDBClient.new()
|
47
|
-
super
|
48
|
-
end
|
49
|
-
end.configure(conf)
|
62
|
+
def create_driver(conf=CONFIG)
|
63
|
+
Fluent::Test::Driver::Output.new(DummyInfluxdbOutput).configure(conf)
|
50
64
|
end
|
51
65
|
|
52
66
|
def test_configure
|
@@ -60,47 +74,63 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
60
74
|
assert_equal('xxxxxx', driver.instance.config['password'])
|
61
75
|
end
|
62
76
|
|
77
|
+
def test_configure_without_tag_chunk_key
|
78
|
+
assert_raise(Fluent::ConfigError) do
|
79
|
+
create_raw_driver %[
|
80
|
+
dbname test
|
81
|
+
user testuser
|
82
|
+
password mypwd
|
83
|
+
<buffer arbitrary_key>
|
84
|
+
@type memory
|
85
|
+
</buffer>
|
86
|
+
]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
63
90
|
def test_format
|
64
|
-
driver = create_driver(CONFIG
|
91
|
+
driver = create_driver(CONFIG)
|
65
92
|
time = event_time('2011-01-02 13:14:15 UTC')
|
66
93
|
|
67
|
-
driver.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
driver.expect_format(['test', time, {'a' => 2}].to_msgpack)
|
94
|
+
driver.run(default_tag: 'test') do
|
95
|
+
driver.feed(time, {'a' => 1})
|
96
|
+
driver.feed(time, {'a' => 2})
|
97
|
+
end
|
72
98
|
|
73
|
-
|
99
|
+
assert_equal [[time, {'a' => 1}].to_msgpack,
|
100
|
+
[time, {'a' => 2}].to_msgpack], driver.formatted
|
74
101
|
end
|
75
102
|
|
76
|
-
|
77
|
-
|
103
|
+
sub_test_case "#write" do
|
104
|
+
test "buffer" do
|
105
|
+
driver = create_driver(CONFIG)
|
78
106
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
107
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
108
|
+
driver.run(default_tag: 'input.influxdb') do
|
109
|
+
driver.feed(time, {'a' => 1})
|
110
|
+
driver.feed(time, {'a' => 2})
|
111
|
+
end
|
83
112
|
|
84
|
-
|
85
|
-
[
|
113
|
+
assert_equal([
|
86
114
|
[
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
115
|
+
[
|
116
|
+
{
|
117
|
+
timestamp: time,
|
118
|
+
series: 'input.influxdb',
|
119
|
+
tags: {},
|
120
|
+
values: {'a' => 1}
|
121
|
+
},
|
122
|
+
{
|
123
|
+
timestamp: time,
|
124
|
+
series: 'input.influxdb',
|
125
|
+
tags: {},
|
126
|
+
values: {'a' => 2}
|
127
|
+
},
|
128
|
+
],
|
129
|
+
nil,
|
130
|
+
nil
|
131
|
+
]
|
132
|
+
], driver.instance.influxdb.points)
|
133
|
+
end
|
104
134
|
end
|
105
135
|
|
106
136
|
def test_write_with_measurement
|
@@ -109,12 +139,13 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
109
139
|
measurement test
|
110
140
|
)
|
111
141
|
|
112
|
-
driver = create_driver(config_with_measurement
|
142
|
+
driver = create_driver(config_with_measurement)
|
113
143
|
|
114
144
|
time = event_time('2011-01-02 13:14:15 UTC')
|
115
|
-
driver.
|
116
|
-
|
117
|
-
|
145
|
+
driver.run(default_tag: 'input.influxdb') do
|
146
|
+
driver.feed(time, {'a' => 1})
|
147
|
+
driver.feed(time, {'a' => 2})
|
148
|
+
end
|
118
149
|
|
119
150
|
assert_equal([
|
120
151
|
[
|
@@ -144,35 +175,35 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
144
175
|
tag_keys ["b"]
|
145
176
|
)
|
146
177
|
|
147
|
-
driver = create_driver(config_with_tags
|
148
|
-
|
149
|
-
time = event_time('2011-01-02 13:14:15 UTC')
|
150
|
-
driver.emit({'a' => 1, 'b' => ''}, time)
|
151
|
-
driver.emit({'a' => 2, 'b' => 1}, time)
|
152
|
-
driver.emit({'a' => 3, 'b' => ' '}, time)
|
178
|
+
driver = create_driver(config_with_tags)
|
153
179
|
|
154
|
-
|
180
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
181
|
+
driver.run(default_tag: 'input.influxdb') do
|
182
|
+
driver.feed(time, {'a' => 1, 'b' => ''})
|
183
|
+
driver.feed(time, {'a' => 2, 'b' => 1})
|
184
|
+
driver.feed(time, {'a' => 3, 'b' => ' '})
|
185
|
+
end
|
155
186
|
|
156
187
|
assert_equal([
|
157
188
|
[
|
158
189
|
[
|
159
190
|
{
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
191
|
+
timestamp: time,
|
192
|
+
series: 'input.influxdb',
|
193
|
+
values: {'a' => 1},
|
194
|
+
tags: {},
|
164
195
|
},
|
165
196
|
{
|
166
|
-
:
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
197
|
+
timestamp: time,
|
198
|
+
series: 'input.influxdb',
|
199
|
+
values: {'a' => 2},
|
200
|
+
tags: {'b' => 1},
|
170
201
|
},
|
171
202
|
{
|
172
|
-
:
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
203
|
+
timestamp: time,
|
204
|
+
series: 'input.influxdb',
|
205
|
+
values: {'a' => 3},
|
206
|
+
tags: {},
|
176
207
|
},
|
177
208
|
],
|
178
209
|
nil,
|
@@ -188,14 +219,15 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
188
219
|
auto_tags true
|
189
220
|
)
|
190
221
|
|
191
|
-
driver = create_driver(config_with_tags
|
222
|
+
driver = create_driver(config_with_tags)
|
192
223
|
|
193
224
|
time = event_time("2011-01-02 13:14:15 UTC")
|
194
|
-
driver.
|
195
|
-
|
196
|
-
|
225
|
+
driver.run(default_tag: 'input.influxdb') do
|
226
|
+
driver.feed(time, {'a' => 1, 'b' => '1'})
|
227
|
+
driver.feed(time, {'a' => 2, 'b' => 1})
|
228
|
+
driver.feed(time, {'a' => 3, 'b' => ' '})
|
229
|
+
end
|
197
230
|
|
198
|
-
driver.run
|
199
231
|
assert_equal([
|
200
232
|
[
|
201
233
|
[
|
@@ -233,13 +265,14 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
233
265
|
tag_keys ["b"]
|
234
266
|
)
|
235
267
|
|
236
|
-
driver = create_driver(config_with_tags
|
268
|
+
driver = create_driver(config_with_tags)
|
237
269
|
|
238
270
|
time = event_time('2011-01-02 13:14:15 UTC')
|
239
|
-
driver.
|
240
|
-
|
271
|
+
driver.run(default_tag: 'input.influxdb') do
|
272
|
+
driver.feed(time, {'b' => '3'})
|
273
|
+
driver.feed(time, {'a' => 2, 'b' => 1})
|
274
|
+
end
|
241
275
|
|
242
|
-
driver.run
|
243
276
|
assert_equal([
|
244
277
|
[
|
245
278
|
[
|
@@ -255,7 +288,7 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
255
288
|
nil
|
256
289
|
]
|
257
290
|
], driver.instance.influxdb.points)
|
258
|
-
end
|
291
|
+
end
|
259
292
|
|
260
293
|
def test_seq
|
261
294
|
config = %[
|
@@ -269,43 +302,44 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
269
302
|
time_precision s
|
270
303
|
sequence_tag _seq
|
271
304
|
]
|
272
|
-
driver = create_driver(config
|
305
|
+
driver = create_driver(config)
|
273
306
|
|
274
|
-
time = event_time(
|
275
|
-
|
276
|
-
driver.
|
307
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
308
|
+
next_time = Fluent::EventTime.new(time + 1)
|
309
|
+
driver.run(default_tag: 'input.influxdb') do
|
310
|
+
driver.feed(time, {'a' => 1})
|
311
|
+
driver.feed(time, {'a' => 2})
|
277
312
|
|
278
|
-
|
279
|
-
|
280
|
-
|
313
|
+
driver.feed(next_time, {'a' => 1})
|
314
|
+
driver.feed(next_time, {'a' => 2})
|
315
|
+
end
|
281
316
|
|
282
|
-
driver.run
|
283
317
|
assert_equal([
|
284
318
|
[
|
285
319
|
[
|
286
320
|
{
|
287
|
-
:
|
288
|
-
:
|
289
|
-
:
|
290
|
-
:
|
321
|
+
timestamp: time,
|
322
|
+
series: 'input.influxdb',
|
323
|
+
values: {'a' => 1},
|
324
|
+
tags: {'_seq' => 0},
|
291
325
|
},
|
292
326
|
{
|
293
|
-
:
|
294
|
-
:
|
295
|
-
:
|
296
|
-
:
|
327
|
+
timestamp: time,
|
328
|
+
series: 'input.influxdb',
|
329
|
+
values: {'a' => 2},
|
330
|
+
tags: {'_seq' => 1},
|
297
331
|
},
|
298
332
|
{
|
299
|
-
:
|
300
|
-
:
|
301
|
-
:
|
302
|
-
:
|
333
|
+
timestamp: time + 1,
|
334
|
+
series: 'input.influxdb',
|
335
|
+
values: {'a' => 1},
|
336
|
+
tags: {'_seq' => 0},
|
303
337
|
},
|
304
338
|
{
|
305
|
-
:
|
306
|
-
:
|
307
|
-
:
|
308
|
-
:
|
339
|
+
timestamp: time + 1,
|
340
|
+
series: 'input.influxdb',
|
341
|
+
values: {'a' => 2},
|
342
|
+
tags: {'_seq' => 1},
|
309
343
|
}
|
310
344
|
],
|
311
345
|
nil,
|
@@ -319,27 +353,28 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
319
353
|
config = CONFIG + "\n" + %[
|
320
354
|
default_retention_policy ephemeral_1d
|
321
355
|
]
|
322
|
-
driver = create_driver(config
|
356
|
+
driver = create_driver(config)
|
323
357
|
|
324
|
-
time = event_time(
|
325
|
-
driver.
|
326
|
-
|
358
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
359
|
+
driver.run(default_tag: 'input.influxdb') do
|
360
|
+
driver.feed(time, {'a' => 1})
|
361
|
+
driver.feed(time, {'a' => 2})
|
362
|
+
end
|
327
363
|
|
328
|
-
driver.run
|
329
364
|
assert_equal([
|
330
365
|
[
|
331
366
|
[
|
332
367
|
{
|
333
|
-
:
|
334
|
-
:
|
335
|
-
:
|
336
|
-
:
|
368
|
+
timestamp: time,
|
369
|
+
series: 'input.influxdb',
|
370
|
+
tags: {},
|
371
|
+
values: {'a' => 1}
|
337
372
|
},
|
338
373
|
{
|
339
|
-
:
|
340
|
-
:
|
341
|
-
:
|
342
|
-
:
|
374
|
+
timestamp: time,
|
375
|
+
series: 'input.influxdb',
|
376
|
+
tags: {},
|
377
|
+
values: {'a' => 2}
|
343
378
|
},
|
344
379
|
],
|
345
380
|
nil,
|
@@ -353,22 +388,23 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
353
388
|
config = CONFIG + "\n" + %[
|
354
389
|
retention_policy_key rp
|
355
390
|
]
|
356
|
-
driver = create_driver(config
|
391
|
+
driver = create_driver(config)
|
357
392
|
|
358
|
-
time = event_time(
|
359
|
-
driver.
|
360
|
-
|
361
|
-
|
393
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
394
|
+
driver.run(default_tag: 'input.influxdb') do
|
395
|
+
driver.feed(time, {'a' => 1})
|
396
|
+
driver.feed(time, {'a' => 2, 'rp' => 'ephemeral_1d'})
|
397
|
+
driver.feed(time, {'a' => 3, 'rp' => 'ephemeral_1m'})
|
398
|
+
end
|
362
399
|
|
363
|
-
driver.run
|
364
400
|
assert_equal([
|
365
401
|
[
|
366
402
|
[
|
367
403
|
{
|
368
|
-
:
|
369
|
-
:
|
370
|
-
:
|
371
|
-
:
|
404
|
+
timestamp: time,
|
405
|
+
series: 'input.influxdb',
|
406
|
+
tags: {},
|
407
|
+
values: {'a' => 1},
|
372
408
|
}
|
373
409
|
],
|
374
410
|
nil,
|
@@ -377,10 +413,10 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
377
413
|
[
|
378
414
|
[
|
379
415
|
{
|
380
|
-
:
|
381
|
-
:
|
382
|
-
:
|
383
|
-
:
|
416
|
+
timestamp: time,
|
417
|
+
series: 'input.influxdb',
|
418
|
+
tags: {},
|
419
|
+
values: {'a' => 2},
|
384
420
|
}
|
385
421
|
],
|
386
422
|
nil,
|
@@ -389,10 +425,10 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
389
425
|
[
|
390
426
|
[
|
391
427
|
{
|
392
|
-
:
|
393
|
-
:
|
394
|
-
:
|
395
|
-
:
|
428
|
+
timestamp: time,
|
429
|
+
series: 'input.influxdb',
|
430
|
+
tags: {},
|
431
|
+
values: {'a' => 3},
|
396
432
|
}
|
397
433
|
],
|
398
434
|
nil,
|
@@ -407,29 +443,30 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
407
443
|
default_retention_policy ephemeral_1d
|
408
444
|
retention_policy_key rp
|
409
445
|
]
|
410
|
-
driver = create_driver(config
|
446
|
+
driver = create_driver(config)
|
411
447
|
|
412
|
-
time = event_time(
|
413
|
-
driver.
|
414
|
-
|
415
|
-
|
416
|
-
|
448
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
449
|
+
driver.run(default_tag: 'input.influxdb') do
|
450
|
+
driver.feed(time, {'a' => 1})
|
451
|
+
driver.feed(time, {'a' => 2, 'rp' => 'ephemeral_1d'})
|
452
|
+
driver.feed(time, {'a' => 3, 'rp' => 'ephemeral_1m'})
|
453
|
+
driver.feed(time, {'a' => 4})
|
454
|
+
end
|
417
455
|
|
418
|
-
driver.run
|
419
456
|
assert_equal([
|
420
457
|
[
|
421
458
|
[
|
422
459
|
{
|
423
|
-
:
|
424
|
-
:
|
425
|
-
:
|
426
|
-
:
|
460
|
+
timestamp: time,
|
461
|
+
series: 'input.influxdb',
|
462
|
+
tags: {},
|
463
|
+
values: {'a' => 1},
|
427
464
|
},
|
428
465
|
{
|
429
|
-
:
|
430
|
-
:
|
431
|
-
:
|
432
|
-
:
|
466
|
+
timestamp: time,
|
467
|
+
series: 'input.influxdb',
|
468
|
+
tags: {},
|
469
|
+
values: {'a' => 2},
|
433
470
|
}
|
434
471
|
],
|
435
472
|
nil,
|
@@ -438,10 +475,10 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
438
475
|
[
|
439
476
|
[
|
440
477
|
{
|
441
|
-
:
|
442
|
-
:
|
443
|
-
:
|
444
|
-
:
|
478
|
+
timestamp: time,
|
479
|
+
series: 'input.influxdb',
|
480
|
+
tags: {},
|
481
|
+
values: {'a' => 3},
|
445
482
|
}
|
446
483
|
],
|
447
484
|
nil,
|
@@ -450,10 +487,10 @@ class InfluxdbOutputTest < Test::Unit::TestCase
|
|
450
487
|
[
|
451
488
|
[
|
452
489
|
{
|
453
|
-
:
|
454
|
-
:
|
455
|
-
:
|
456
|
-
:
|
490
|
+
timestamp: time,
|
491
|
+
series: 'input.influxdb',
|
492
|
+
tags: {},
|
493
|
+
values: {'a' => 4},
|
457
494
|
}
|
458
495
|
],
|
459
496
|
nil,
|
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.
|
4
|
+
version: 1.0.0.rc1
|
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-
|
12
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
@@ -38,9 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.2.0
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0.4'
|
44
41
|
type: :runtime
|
45
42
|
prerelease: false
|
46
43
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -48,9 +45,6 @@ dependencies:
|
|
48
45
|
- - ">="
|
49
46
|
- !ruby/object:Gem::Version
|
50
47
|
version: 0.2.0
|
51
|
-
- - "<"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0.4'
|
54
48
|
- !ruby/object:Gem::Dependency
|
55
49
|
name: rake
|
56
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,12 +120,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
120
|
version: '0'
|
127
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
122
|
requirements:
|
129
|
-
- - "
|
123
|
+
- - ">"
|
130
124
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
125
|
+
version: 1.3.1
|
132
126
|
requirements: []
|
133
127
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.5.2
|
135
129
|
signing_key:
|
136
130
|
specification_version: 4
|
137
131
|
summary: A buffered output plugin for fluentd and influxDB
|