influxdb-client 2.0.0 → 2.1.0.pre.3812
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -3
- data/README.md +1 -1
- data/lib/influxdb-client.rb +1 -0
- data/lib/influxdb2/client/client.rb +9 -0
- data/lib/influxdb2/client/health_api.rb +1 -0
- data/lib/influxdb2/client/ping_api.rb +65 -0
- data/lib/influxdb2/client/version.rb +1 -1
- data/test/influxdb/client_test.rb +20 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a3fcf08b154394bbe7a5c20a3025e258d78696436ecef75c769e22ccfb3512e
|
4
|
+
data.tar.gz: 49360f4aaf8995b26a460e5170d8c23959c1bc3610fe834a76f3e03479595820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960131b0ab69dfbcb7a907795b118500a299295211feec800727390fae8eabaafb5733bf031fb56b7388f8aea8385e24c57b651e08e70ac126604925b2248a47
|
7
|
+
data.tar.gz: a15a699c569bf89689273217f7efe2ec9b53a354344b6714003e3ff9eb89aa210f1a3c6c875451a77c07be4bc6d97d799e8f7fea9e53d1a5e23a61eaf4b7fc4e
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
## 2.1.0 [unreleased]
|
2
|
+
|
3
|
+
### Features
|
4
|
+
1. [#93](https://github.com/influxdata/influxdb-client-ruby/pull/93): Add `PingApi` to check status of OSS and Cloud instance
|
5
|
+
|
6
|
+
### CI
|
7
|
+
1. [#91](https://github.com/influxdata/influxdb-client-ruby/pull/91): Switch to next-gen CircleCI's convenience images
|
8
|
+
1. [#95](https://github.com/influxdata/influxdb-client-ruby/pull/95): Update `jruby` to `9.3.1.0-jdk11`
|
9
|
+
|
1
10
|
## 2.0.0 [2021-09-13]
|
2
11
|
|
3
12
|
### Bug Fixes
|
4
13
|
1. [#90](https://github.com/influxdata/influxdb-client-ruby/pull/90): Fix parse text plain 503 error response
|
14
|
+
1. [#89](https://github.com/influxdata/influxdb-client-ruby/pull/89): Correct redirect location
|
5
15
|
|
6
16
|
### Breaking Changes
|
7
17
|
Due to a security reason `Authorization` header is not forwarded when redirect leads to a different domain.
|
@@ -9,9 +19,6 @@ To overcome this limitation you have to set the client property `redirect_forwar
|
|
9
19
|
|
10
20
|
### Features
|
11
21
|
1. [#89](https://github.com/influxdata/influxdb-client-ruby/pull/89): `Authorization` header is not forwarded when redirect leads to a different domain
|
12
|
-
|
13
|
-
### Bug Fixes
|
14
|
-
1. [#89](https://github.com/influxdata/influxdb-client-ruby/pull/89): Correct redirect location
|
15
22
|
|
16
23
|
## 1.17.0 [2021-08-20]
|
17
24
|
|
data/README.md
CHANGED
@@ -400,7 +400,7 @@ client.close!
|
|
400
400
|
|
401
401
|
### Check the server status
|
402
402
|
|
403
|
-
Server availability can be checked using the `client.
|
403
|
+
Server availability can be checked using the `client.ping` method. That is equivalent of the [influx ping](https://v2.docs.influxdata.com/v2.0/reference/cli/influx/ping/).
|
404
404
|
|
405
405
|
### Proxy configuration
|
406
406
|
|
data/lib/influxdb-client.rb
CHANGED
@@ -26,6 +26,7 @@ require 'influxdb2/client/write_api'
|
|
26
26
|
require 'influxdb2/client/query_api'
|
27
27
|
require 'influxdb2/client/delete_api'
|
28
28
|
require 'influxdb2/client/health_api'
|
29
|
+
require 'influxdb2/client/ping_api'
|
29
30
|
require 'influxdb2/client/point'
|
30
31
|
require 'influxdb2/client/flux_table'
|
31
32
|
require 'influxdb2/client/write_retry'
|
@@ -87,11 +87,20 @@ module InfluxDB2
|
|
87
87
|
|
88
88
|
# Get the health of an instance.
|
89
89
|
#
|
90
|
+
# @deprecated Use `ping` instead
|
90
91
|
# @return [HealthCheck]
|
91
92
|
def health
|
92
93
|
HealthApi.new(options: @options).health
|
93
94
|
end
|
94
95
|
|
96
|
+
# Checks the status of InfluxDB instance and version of InfluxDB.
|
97
|
+
#
|
98
|
+
# @deprecated Use `ping` instead
|
99
|
+
# @return [Ping]
|
100
|
+
def ping
|
101
|
+
PingApi.new(options: @options).ping
|
102
|
+
end
|
103
|
+
|
95
104
|
# Close all connections into InfluxDB 2.
|
96
105
|
#
|
97
106
|
# @return [ true ] Always true.
|
@@ -22,6 +22,7 @@ require_relative 'models/health_check'
|
|
22
22
|
module InfluxDB2
|
23
23
|
# The client of the InfluxDB 2.0 that implement Health HTTP API endpoint.
|
24
24
|
#
|
25
|
+
# @deprecated Use `PingApi` instead
|
25
26
|
class HealthApi < DefaultApi
|
26
27
|
# @param [Hash] options The options to be used by the client.
|
27
28
|
def initialize(options:)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
require_relative 'models/health_check'
|
21
|
+
|
22
|
+
module InfluxDB2
|
23
|
+
# The client of the InfluxDB 2.0 that implement Ping HTTP API endpoint.
|
24
|
+
#
|
25
|
+
class PingApi < DefaultApi
|
26
|
+
# @param [Hash] options The options to be used by the client.
|
27
|
+
def initialize(options:)
|
28
|
+
super(options: options)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Checks the status of InfluxDB instance and version of InfluxDB.
|
32
|
+
#
|
33
|
+
# @return [Ping]
|
34
|
+
def ping
|
35
|
+
uri = _parse_uri('/ping')
|
36
|
+
headers = _get(uri)
|
37
|
+
Ping.new.tap do |model|
|
38
|
+
model.status = 'ok'
|
39
|
+
model.build = headers['X-Influxdb-Build']
|
40
|
+
model.version = headers['X-Influxdb-Version']
|
41
|
+
model.message = 'ready for queries and writes'
|
42
|
+
end
|
43
|
+
rescue StandardError => e
|
44
|
+
Ping.new.tap do |model|
|
45
|
+
model.status = 'fail'
|
46
|
+
model.message = e.message
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# The status of InfluxDB instance and version of InfluxDB.
|
52
|
+
class Ping
|
53
|
+
# The type of InfluxDB build.
|
54
|
+
attr_accessor :build
|
55
|
+
|
56
|
+
# The version of InfluxDB.
|
57
|
+
attr_accessor :version
|
58
|
+
|
59
|
+
# The status of InfluxDB.
|
60
|
+
attr_accessor :status
|
61
|
+
|
62
|
+
# The error message.
|
63
|
+
attr_accessor :message
|
64
|
+
end
|
65
|
+
end
|
@@ -90,6 +90,26 @@ class ClientTest < Minitest::Test
|
|
90
90
|
assert_equal 'fail', health.status
|
91
91
|
end
|
92
92
|
|
93
|
+
def test_ping
|
94
|
+
client = InfluxDB2::Client.new('http://localhost:8086', 'my-token', use_ssl: false)
|
95
|
+
|
96
|
+
ping = client.ping
|
97
|
+
assert_equal 'ready for queries and writes', ping.message
|
98
|
+
assert_equal 'OSS, oss2', ping.build
|
99
|
+
assert_equal 'ok', ping.status
|
100
|
+
refute_empty ping.version
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_ping_not_running
|
104
|
+
client_not_running = InfluxDB2::Client.new('http://localhost:8099', 'my-token', use_ssl: false)
|
105
|
+
ping = client_not_running.ping
|
106
|
+
|
107
|
+
assert_match 'Failed to open TCP connection to localhost:8099', ping.message
|
108
|
+
assert_equal 'fail', ping.status
|
109
|
+
assert_nil ping.build
|
110
|
+
assert_nil ping.version
|
111
|
+
end
|
112
|
+
|
93
113
|
def test_trailing_slash_in_url
|
94
114
|
uri = URI.parse(File.join('http://localhost:8099', '/api/v2/write'))
|
95
115
|
assert_equal 'http://localhost:8099/api/v2/write', uri.to_s
|
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.
|
4
|
+
version: 2.1.0.pre.3812
|
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-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/influxdb2/client/models/dialect.rb
|
147
147
|
- lib/influxdb2/client/models/health_check.rb
|
148
148
|
- lib/influxdb2/client/models/query.rb
|
149
|
+
- lib/influxdb2/client/ping_api.rb
|
149
150
|
- lib/influxdb2/client/point.rb
|
150
151
|
- lib/influxdb2/client/query_api.rb
|
151
152
|
- lib/influxdb2/client/version.rb
|
@@ -184,11 +185,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
185
|
version: 2.2.0
|
185
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
187
|
requirements:
|
187
|
-
- - "
|
188
|
+
- - ">"
|
188
189
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
190
|
+
version: 1.3.1
|
190
191
|
requirements: []
|
191
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.2.22
|
192
193
|
signing_key:
|
193
194
|
specification_version: 4
|
194
195
|
summary: Ruby library for InfluxDB 2.
|