influxdb-client 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/influxdb2/client/point.rb +8 -3
- data/lib/influxdb2/client/version.rb +1 -1
- data/lib/influxdb2/client/worker.rb +1 -1
- data/test/influxdb/point_test.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20cf81cf2a456afa228493a541328eec06036b33f89f1c55097a8c0fa49369c9
|
4
|
+
data.tar.gz: c810d0079ec382f83f3d8907be4510b48592646f62fc483c791f88494e3b2a3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f44b8975945893946b73abd129ec6f2c3da49bb3d8dc45511de53d9b3d7a022fde44396f02da682d404c0778070a703d4c4fdab1e07187763a080d3850dc7d1
|
7
|
+
data.tar.gz: 03d1c1463657348726eb82b8aaa061fe0b96be2a2d3baae6e90717bf090923a6e1823cbe70d0017c0023bf785379088077f6ba2eaf2866dbcd8a2e33f89da275
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 1.6.0 [2020-07-17]
|
2
|
+
|
3
|
+
### Bug Fixes
|
4
|
+
1. [#42](https://github.com/influxdata/influxdb-client-ruby/pull/42): Fixed serialization of `\n`, `\r` and `\t` to Line Protocol, `=` is valid sign for measurement name
|
5
|
+
1. [#44](https://github.com/influxdata/influxdb-client-ruby/pull/44): Fixed supporting of Ruby 2.2
|
6
|
+
|
1
7
|
## 1.5.0 [2020-06-19]
|
2
8
|
|
3
9
|
### API
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ The client can be installed manually or with bundler.
|
|
23
23
|
To install the client gem manually:
|
24
24
|
|
25
25
|
```
|
26
|
-
gem install influxdb-client -v 1.
|
26
|
+
gem install influxdb-client -v 1.6.0
|
27
27
|
```
|
28
28
|
|
29
29
|
## Usage
|
@@ -122,7 +122,7 @@ The writes are processed in batches which are configurable by `WriteOptions`:
|
|
122
122
|
| Property | Description | Default Value |
|
123
123
|
| --- | --- | --- |
|
124
124
|
| batchSize | the number of data point to collect in batch | 1000 |
|
125
|
-
|
|
125
|
+
| flush_interval | the number of milliseconds before the batch is written | 1000 |
|
126
126
|
| retry_interval | the number of milliseconds to retry unsuccessful write. The retry interval is used when the InfluxDB server does not specify "Retry-After" header. | 1000 |
|
127
127
|
| jitter_interval | the number of milliseconds to increase the batch flush interval by a random amount | 0 |
|
128
128
|
|
@@ -21,6 +21,8 @@
|
|
21
21
|
module InfluxDB2
|
22
22
|
DEFAULT_WRITE_PRECISION = WritePrecision::NANOSECOND
|
23
23
|
ESCAPE_KEY_LIST = ['\\'.freeze, ','.freeze, ' '.freeze, '='.freeze].freeze
|
24
|
+
ESCAPE_MEASUREMENT_LIST = ['\\'.freeze, ','.freeze, ' '.freeze].freeze
|
25
|
+
REPLACE_KEY_LIST = { "\n".freeze => '\n'.freeze, "\r".freeze => '\r'.freeze, "\t".freeze => '\t'.freeze }.freeze
|
24
26
|
ESCAPE_VALUE_LIST = ['\\'.freeze, '"'.freeze].freeze
|
25
27
|
|
26
28
|
# Point defines the values that will be written to the database.
|
@@ -113,7 +115,7 @@ module InfluxDB2
|
|
113
115
|
# @return a string representation of the point
|
114
116
|
def to_line_protocol
|
115
117
|
line_protocol = ''
|
116
|
-
measurement = _escape_key(@name || '')
|
118
|
+
measurement = _escape_key(@name || '', ESCAPE_MEASUREMENT_LIST)
|
117
119
|
|
118
120
|
line_protocol << measurement
|
119
121
|
|
@@ -161,11 +163,14 @@ module InfluxDB2
|
|
161
163
|
end.reject(&:nil?).join(','.freeze)
|
162
164
|
end
|
163
165
|
|
164
|
-
def _escape_key(value)
|
166
|
+
def _escape_key(value, escape_list = ESCAPE_KEY_LIST)
|
165
167
|
result = value.dup
|
166
|
-
|
168
|
+
escape_list.each do |ch|
|
167
169
|
result = result.gsub(ch) { "\\#{ch}" }
|
168
170
|
end
|
171
|
+
REPLACE_KEY_LIST.keys.each do |ch|
|
172
|
+
result = result.gsub(ch) { REPLACE_KEY_LIST[ch] }
|
173
|
+
end
|
169
174
|
result
|
170
175
|
end
|
171
176
|
|
data/test/influxdb/point_test.rb
CHANGED
@@ -218,4 +218,25 @@ class PointTest < MiniTest::Test
|
|
218
218
|
|
219
219
|
assert_equal 'h2o level=2i 123', point.to_line_protocol
|
220
220
|
end
|
221
|
+
|
222
|
+
def test_tag_escaping
|
223
|
+
point = InfluxDB2::Point.new(name: "h\n2\ro\t_data")
|
224
|
+
.add_tag("new\nline", "new\nline")
|
225
|
+
.add_tag("carriage\rreturn", "carriage\nreturn")
|
226
|
+
.add_tag("t\tab", "t\tab")
|
227
|
+
.add_field('level', 2)
|
228
|
+
|
229
|
+
puts point.to_line_protocol
|
230
|
+
|
231
|
+
assert_equal 'h\\n2\\ro\\t_data,carriage\\rreturn=carriage\\nreturn,new\\nline=new\\nline,t\\tab=t\\tab level=2i',
|
232
|
+
point.to_line_protocol
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_equal_sign_escaping
|
236
|
+
point = InfluxDB2::Point.new(name: 'h=2o')
|
237
|
+
.add_tag('l=ocation', 'e=urope')
|
238
|
+
.add_field('l=evel', 2)
|
239
|
+
|
240
|
+
assert_equal 'h=2o,l\\=ocation=e\\=urope l\\=evel=2i', point.to_line_protocol
|
241
|
+
end
|
221
242
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Bednar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|