influxdb-client 1.6.0.pre.916 → 1.7.0.pre.1015

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
  SHA256:
3
- metadata.gz: 4c77af86f0b9b7749ddbf9d5111c76839f492f587ecb38d104a817af22048a2f
4
- data.tar.gz: 290a21b26ce9eeb84ee746ff29bc7100c825b37548c795e8f398c8dafbfa1784
3
+ metadata.gz: 8f7d3acebd47909037578d03e9c41a563328fc8a112019ef705417f4ce0b5dc7
4
+ data.tar.gz: f5fd4db9b000fb952eedd3ef7cbdc93fec3b5806101d819fd5c9febc33b95a68
5
5
  SHA512:
6
- metadata.gz: f979e9911c370f77d376dc99035055c35241588007f9d30864fb9bd5db3be87b257a358a6ae6dbacdee68e5a5b95da871f2556e572078fdf939f02f7a6479a69
7
- data.tar.gz: 5d40d9c3981bed04fab6ac9d45d881e8367abe80449a42294bf6eeec775ba830beeba8edc331910d68f286c6db574fcc921924bae5c9035b9d159c19fcc380bd
6
+ metadata.gz: 1da2d03a086ad92b8c7d82a29cdff3e228dd9140808df9b3ae1ed961670535ad8125d3345202b5dc6dad0f7d370057f24e8607f9bfc6479d756bbea61e04cebd
7
+ data.tar.gz: 1fe5947810dff9c7d97ec8eefc4d2d54d8e67db663c42e2ae606747f444bd96b9083beb1439e27fb2d2fd1c1fc6bae055d3ffd9816f0819b85039eb47b37f7a8
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ ---
5
+
6
+ <!--
7
+
8
+ Thank you for reporting a bug.
9
+
10
+ * Please add a :+1: or comment on a similar existing bug report instead of opening a new one.
11
+ * https://github.com/influxdata/influxdb-client-ruby/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+is%3Aclosed+sort%3Aupdated-desc+label%3Abug+
12
+ * Please check whether the bug can be reproduced with the latest release.
13
+ * The fastest way to fix a bug is to open a Pull Request.
14
+ * https://github.com/influxdata/influxdb-client-ruby/pulls
15
+
16
+ -->
17
+
18
+ __Steps to reproduce:__
19
+ List the minimal actions needed to reproduce the behavior.
20
+
21
+ 1. ...
22
+ 2. ...
23
+ 3. ...
24
+
25
+ __Expected behavior:__
26
+ Describe what you expected to happen.
27
+
28
+ __Actual behavior:__
29
+ Describe What actually happened.
30
+
31
+ __Specifications:__
32
+ - Client Version:
33
+ - InfluxDB Version:
34
+ - Platform:
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Feature request
3
+ about: Opening a feature request kicks off a discussion
4
+ ---
5
+
6
+ <!--
7
+
8
+ Thank you for suggesting an idea to improve this client.
9
+
10
+ * Please add a :+1: or comment on a similar existing feature request instead of opening a new one.
11
+ * https://github.com/influxdata/influxdb-client-ruby/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+is%3Aclosed+sort%3Aupdated-desc+label%3A%22enhancement%22+
12
+
13
+ -->
14
+
15
+ __Proposal:__
16
+ Short summary of the feature.
17
+
18
+ __Current behavior:__
19
+ Describe what currently happens.
20
+
21
+ __Desired behavior:__
22
+ Describe what you want.
23
+
24
+ __Alternatives considered:__
25
+ Describe other solutions or features you considered.
26
+
27
+ __Use case:__
28
+ Why is this important (helps with prioritizing requests)?
@@ -1,8 +1,16 @@
1
1
  Closes #
2
2
 
3
+ ## Proposed Changes
4
+
3
5
  _Briefly describe your proposed changes:_
4
6
 
7
+ ## Checklist
8
+
9
+ <!-- Checkboxes below this note can be erased if not applicable to your Pull Request. -->
10
+
5
11
  - [ ] CHANGELOG.md updated
6
12
  - [ ] Rebased/mergeable
7
- - [ ] Tests pass
8
- - [ ] Sign [CLA](https://influxdata.com/community/cla/) (if not already signed)
13
+ - [ ] A test has been added if appropriate
14
+ - [ ] `rake test` completes successfully
15
+ - [ ] Commit messages are in [semantic format](https://seesparkbox.com/foundry/semantic_commit_messages)
16
+ - [ ] Sign [CLA](https://influxdata.com/community/cla/) (if not already signed)
@@ -0,0 +1,3 @@
1
+ # docs: https://github.com/probot/semantic-pull-requests#configuration
2
+ # Always validate the PR title AND all the commits
3
+ titleAndCommits: true
@@ -1,4 +1,10 @@
1
- ## 1.6.0 [unreleased]
1
+ ## 1.7.0 [unreleased]
2
+
3
+ ## 1.6.0 [2020-07-17]
4
+
5
+ ### Bug Fixes
6
+ 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
7
+ 1. [#44](https://github.com/influxdata/influxdb-client-ruby/pull/44): Fixed supporting of Ruby 2.2
2
8
 
3
9
  ## 1.5.0 [2020-06-19]
4
10
 
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.5.0
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
- | flushInterval | the number of milliseconds before the batch is written | 1000 |
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
- ESCAPE_KEY_LIST.each do |ch|
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
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '1.6.0'.freeze
22
+ VERSION = '1.7.0'.freeze
23
23
  end
@@ -99,7 +99,7 @@ module InfluxDB2
99
99
  end
100
100
 
101
101
  def _write_raw(key, points)
102
- if @write_options.jitter_interval.positive?
102
+ if @write_options.jitter_interval > 0
103
103
  jitter_delay = (@write_options.jitter_interval.to_f / 1_000) * rand
104
104
  sleep jitter_delay
105
105
  end
@@ -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.6.0.pre.916
4
+ version: 1.7.0.pre.1015
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-06-19 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,7 +132,10 @@ files:
132
132
  - ".circleci/config.yml"
133
133
  - ".circleci/setup-rubygems.sh"
134
134
  - ".codecov.yml"
135
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
136
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
135
137
  - ".github/PULL_REQUEST_TEMPLATE"
138
+ - ".github/semantic.yml"
136
139
  - ".gitignore"
137
140
  - ".rubocop.yml"
138
141
  - CHANGELOG.md