fluent-plugin-influxdb 1.0.0 → 1.1.0

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: 14be1643f9cb54355607b9c89c7431822437a737
4
- data.tar.gz: 2aabaac2e4731df0666ed1bb3ed952c11ce159fa
3
+ metadata.gz: e7e725de952732ecd13619697db660c726654590
4
+ data.tar.gz: cac3f23f7b11d13417c8e4e42d66502c72a9ff0c
5
5
  SHA512:
6
- metadata.gz: b6189486b6c5d849da9adcf542754346627efdf28daf0766b3366cd95d75c5334ace76e3c804ca36d58e3b681e9f53d0fbc80c1e93971d0b0640b15d0cddaa7e
7
- data.tar.gz: 91e8817d92be059a2484b4adb6bcb12569cd15a3631c8df7a36280b10593224b2d105c6daca402558d964d10366585853a7ed2748a532fb260da7895ad7cc471
6
+ metadata.gz: 23dd436de2e4d05da0845ae241ec544e23e20950f289b09acaf673833e22f94b2527c7057de4eafcdf82bf4af0fc7bdb4d3efac3ee992bd69dbe2c1c8504eac6
7
+ data.tar.gz: 8221b15b87748a38149e2393366f7f640b45aad12c68786bb6678ae20d2bf8a06f49479f6fa4005cbda5c515e88a8bbb3c4579c2a587c15958b6f35339778746
data/History.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.1.0 (Jan, 21, 2019)
5
+ =====
6
+
7
+ - Skip record which has empty string field
8
+ - Add cast_number_to_float parameter
9
+
4
10
  1.0.0 (Nov, 30, 2017)
5
11
  =====
6
12
 
data/README.md CHANGED
@@ -16,12 +16,10 @@ If you are using InfluxDB version 0.8 please specify version 0.1.8 of this plugi
16
16
  | >= 1.0.0 | >= v0.14.0 | >= 2.1 |
17
17
  | < 1.0.0 | >= v0.12.0 | >= 1.9 |
18
18
 
19
- NOTE: fluent-plugin-influxdb v1.0.0 is now RC. We will release stable v1.0.0 soon.
20
-
21
19
  ## Installation
22
20
 
23
21
  $ 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
22
+ $ fluent-gem install fluent-plugin-influxdb --no-document # for fluentd v0.14 or later
25
23
 
26
24
  ### Ruby 2.0 or earlier
27
25
 
@@ -35,7 +33,7 @@ If you don't have a problem, use ruby 2.1 or later in production.
35
33
 
36
34
  Just like other regular output plugins, Use type `influxdb` in your fluentd configuration under `match` scope:
37
35
 
38
- `type` `influxdb`
36
+ `@type` `influxdb`
39
37
 
40
38
  --------------
41
39
 
@@ -73,6 +71,8 @@ Just like other regular output plugins, Use type `influxdb` in your fluentd conf
73
71
 
74
72
  `retention_policy_key`: The name of the key in the record whose value specifies the retention policy. The default retention policy will be applied if no such key exists. influxdb >= 0.2.3 is required to use this functionality.
75
73
 
74
+ `cast_number_to_float`: Enable/Disable casting number to float. influxdb can't mix integer/float value in one measurement. If your pipeline can't unify record value, this parameter may help. Avoid 'field type conflict' error.
75
+
76
76
  ### Fluentd Tag and InfluxDB Series
77
77
 
78
78
  influxdb plugin uses Fluentd event tag for InfluxDB series.
@@ -103,32 +103,21 @@ If you set `measurement` parameter, use its value instead of event tag.
103
103
  fluentd-plugin-influxdb is a buffered output plugin. So additional buffer configuration would be (with default values):
104
104
 
105
105
  ```
106
- buffer_type memory
107
- buffer_chunk_limit 524288 # 512 * 1024
108
- buffer_queue_limit 1024
109
- flush_interval 60
110
- retry_limit 17
111
- retry_wait 1.0
112
- num_threads 1
106
+ <buffer>
107
+ @type memory
108
+ chunk_limit_size 524288 # 512 * 1024
109
+ chunk_limit_records 1024
110
+ flush_interval 60
111
+ retry_limit 17
112
+ retry_wait 1.0
113
+ num_threads 1
114
+ </buffer>
113
115
  ```
114
116
 
115
117
  The details of BufferedOutput is [here](http://docs.fluentd.org/articles/buffer-plugin-overview).
116
118
 
117
119
  ---
118
120
 
119
- fluentd-plugin-influxdb also includes the HandleTagNameMixin mixin which allows the following additional options:
120
-
121
- ```
122
- remove_tag_prefix <tag_prefix_to_remove_including_the_dot>
123
- remove_tag_suffix <tag_suffix_to_remove_including_the_dot>
124
- add_tag_prefix <tag_prefix_to_add_including_the_dot>
125
- add_tag_suffix <tag_suffix_to_add_including_the_dot>
126
- ```
127
-
128
- ---
129
-
130
- Also please consider using [fluent-plugin-multiprocess](https://github.com/frsyuki/fluent-plugin-multiprocess) to fork multiple threads for your metrics:
131
-
132
121
  ## Contributing
133
122
 
134
123
 
@@ -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 = '1.0.0'
6
+ s.version = '1.1.0'
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}
@@ -53,7 +53,9 @@ DESC
53
53
  desc: "The key of the key in the record that stores the retention policy name"
54
54
  config_param :default_retention_policy, :string, default: nil,
55
55
  desc: "The name of the default retention policy"
56
-
56
+ config_param :cast_number_to_float, :bool, default: false,
57
+ desc: "Enable/Disable casting number to float"
58
+
57
59
  config_section :buffer do
58
60
  config_set_default :@type, DEFAULT_BUFFER_TYPE
59
61
  config_set_default :chunk_keys, ['tag']
@@ -98,11 +100,13 @@ DESC
98
100
  end
99
101
  end
100
102
 
103
+ EMPTY_STRING = ''.freeze
101
104
  FORMATTED_RESULT_FOR_INVALID_RECORD = ''.freeze
102
105
 
103
106
  def format(tag, time, record)
104
- # TODO: Use tag based chunk separation for more reliability
105
- if record.empty? || record.has_value?(nil)
107
+ # nil and '' check should be in influxdb-ruby client...
108
+ if record.empty? || record.has_value?(nil) || record.has_value?(EMPTY_STRING)
109
+ log.warn "Skip record '#{record}' in '#{tag}', because either record has no value or at least a value is 'nil' inside the record."
106
110
  FORMATTED_RESULT_FOR_INVALID_RECORD
107
111
  else
108
112
  [precision_time(time), record].to_msgpack
@@ -158,6 +162,14 @@ DESC
158
162
  log.warn "Skip record '#{record}', because InfluxDB requires at least one value in raw"
159
163
  next
160
164
  end
165
+
166
+ if @cast_number_to_float
167
+ values.each do |key, value|
168
+ if value.is_a?(Integer)
169
+ values[key] = Float(value)
170
+ end
171
+ end
172
+ end
161
173
 
162
174
  point = {
163
175
  timestamp: timestamp,
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: 1.0.0
4
+ version: 1.1.0
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-11-30 00:00:00.000000000 Z
12
+ date: 2019-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.6.13
134
+ rubygems_version: 2.6.14.1
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: A buffered output plugin for fluentd and influxDB