influxdb-client 2.0.0.pre.3196 → 2.0.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 +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +2 -2
- data/lib/influxdb2/client/influx_error.rb +3 -0
- data/test/influxdb/write_api_batching_test.rb +24 -5
- data/test/influxdb/write_api_test.rb +21 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6fd6dd1906594584875d1274c8fb79200e793ced41d6228f7d169e4f5d192a
|
4
|
+
data.tar.gz: 37230349c80c42b2af0999e81fea24ecaced43ff7b8aae583510bacb7cf49538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a4fbcef9b4ce901887d12b659b1467f1cc0d1b123238dc5373f02a0bab5b3bfc477b7572ab3994eef0de1a7a200c005058457d0be4827e929291844c6236f5d
|
7
|
+
data.tar.gz: 4ca1d999089888084313eb50667c44662383d3650d78f15c34a6a01eb36c3dabceec5f3fa389ec697333fb1341ee639671b3fe12fb41e84a0d90f3603c6f18c1
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
## 2.0.0 [
|
1
|
+
## 2.0.0 [2021-09-13]
|
2
|
+
|
3
|
+
### Bug Fixes
|
4
|
+
1. [#90](https://github.com/influxdata/influxdb-client-ruby/pull/90): Fix parse text plain 503 error response
|
2
5
|
|
3
6
|
### Breaking Changes
|
4
7
|
Due to a security reason `Authorization` header is not forwarded when redirect leads to a different domain.
|
data/README.md
CHANGED
@@ -64,13 +64,13 @@ The client can be installed manually or with bundler.
|
|
64
64
|
To install the client gem manually:
|
65
65
|
|
66
66
|
```
|
67
|
-
gem install influxdb-client -v
|
67
|
+
gem install influxdb-client -v 2.0.0
|
68
68
|
```
|
69
69
|
|
70
70
|
For management API:
|
71
71
|
|
72
72
|
```
|
73
|
-
gem install influxdb-client-apis -v
|
73
|
+
gem install influxdb-client-apis -v 2.0.0
|
74
74
|
```
|
75
75
|
|
76
76
|
## Usage
|
@@ -35,6 +35,9 @@ module InfluxDB2
|
|
35
35
|
obj = new(message: json['message'] || '', code: response.code, reference: json['code'] || '',
|
36
36
|
retry_after: response['Retry-After'] || '')
|
37
37
|
obj
|
38
|
+
rescue JSON::ParserError
|
39
|
+
new(message: response.body || '', code: response.code, reference: '',
|
40
|
+
retry_after: response['Retry-After'] || '')
|
38
41
|
end
|
39
42
|
|
40
43
|
def self.from_message(message)
|
@@ -210,11 +210,6 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
210
210
|
@write_client.write(data: ['h2o_feet,location=coyote_creek water_level=1.0 1',
|
211
211
|
'h2o_feet,location=coyote_creek water_level=2.0 2'])
|
212
212
|
|
213
|
-
sleep(0.05)
|
214
|
-
|
215
|
-
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
216
|
-
times: 0, body: request)
|
217
|
-
|
218
213
|
sleep(2)
|
219
214
|
|
220
215
|
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
@@ -617,4 +612,28 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
617
612
|
assert_gte backoff, 1_600
|
618
613
|
assert_lte backoff, 2_000
|
619
614
|
end
|
615
|
+
|
616
|
+
def test_write_error_plain_retry
|
617
|
+
error_body = 'Service Unavailable'
|
618
|
+
stub_request(:any, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
619
|
+
.to_return(status: 503, headers: { 'content-type' => 'text/plain', 'Retry-After' => '2' }, body: error_body)
|
620
|
+
.to_return(status: 503, headers: { 'content-type' => 'text/plain' }, body: error_body).to_return(status: 204)
|
621
|
+
|
622
|
+
client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
623
|
+
bucket: 'my-bucket',
|
624
|
+
org: 'my-org',
|
625
|
+
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
626
|
+
use_ssl: false)
|
627
|
+
|
628
|
+
@write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
|
629
|
+
batch_size: 1, flush_interval: 1_000, retry_interval: 1_000)
|
630
|
+
|
631
|
+
write_api = client.create_write_api(write_options: @write_options)
|
632
|
+
request = 'h2o,location=west value=33i 15'
|
633
|
+
write_api.write(data: request)
|
634
|
+
|
635
|
+
sleep(10)
|
636
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
637
|
+
times: 3, body: request)
|
638
|
+
end
|
620
639
|
end
|
@@ -384,4 +384,25 @@ class WriteApiDefaultTagsTest < MiniTest::Test
|
|
384
384
|
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
385
385
|
times: 1, body: expected)
|
386
386
|
end
|
387
|
+
|
388
|
+
def test_write_error_plain
|
389
|
+
error_body = 'Service Unavailable'
|
390
|
+
stub_request(:any, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
391
|
+
.to_return(status: 503, headers: { 'content-type' => 'text/plain' },
|
392
|
+
body: error_body)
|
393
|
+
|
394
|
+
client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
395
|
+
bucket: 'my-bucket',
|
396
|
+
org: 'my-org',
|
397
|
+
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
398
|
+
use_ssl: false)
|
399
|
+
|
400
|
+
error = assert_raises InfluxDB2::InfluxError do
|
401
|
+
write_api = client.create_write_api
|
402
|
+
write_api.write(data: 'h2o,location=west value=33i 15')
|
403
|
+
end
|
404
|
+
|
405
|
+
assert_equal '503', error.code
|
406
|
+
assert_equal 'Service Unavailable', error.message
|
407
|
+
end
|
387
408
|
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: 2.0.0
|
4
|
+
version: 2.0.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: 2021-
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -184,9 +184,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: 2.2.0
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- - "
|
187
|
+
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
189
|
+
version: '0'
|
190
190
|
requirements: []
|
191
191
|
rubygems_version: 3.0.3.1
|
192
192
|
signing_key:
|