influxdb-client 2.1.0.pre.3380 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 594977f22ac698a141e1123cbdb730dc87b16933f2f28d03098eec6480791ff1
4
- data.tar.gz: 20ef07b3c2e19e50c8ba031d768c86747e3f3c13ca80b1bf416cdbe9e0f066d0
3
+ metadata.gz: be3ac6c581d2ec4f1bea7183b78bc8d189510a9815cd54483e09611ca65402bd
4
+ data.tar.gz: 5c18d34011098b03d9226188d5663a1c16b2b02348931409bf7fb5fb832dbb10
5
5
  SHA512:
6
- metadata.gz: a0adda077801b92b62e22a735f4c0bcb3494716d0f0694191c4da50b51927fea24f37c3d67c57df12354b10baf652e41bca9baca1cd7c59aaafe138a5a786b51
7
- data.tar.gz: 6c6c84ba4068dd6189244de3fe3921f6baa1642d75c5dadd4009e4e7cb7924e641b6ad194766d7486e375b84cccb2a780ba0fd5585c32eea6320b2c2cc3c4e2e
6
+ metadata.gz: 5e998c044335d66a56dcf9b25e53fbdbac305307458a456a451c517698e2e6f1295ea44bb11142fbbad6e42856e1a0e5fa1f0c6105cc3a9711a1efdc30ebfe8f
7
+ data.tar.gz: 58626af8588b716b4b4edba032c0a5d28b8a5645080ad0cd2ba39ded13d529025c6029aee5ac66e687a6143c6c4795d356730f74fbc78f78d551299745194217
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- ## 2.1.0 [unreleased]
1
+ ## 2.1.0 [2021-10-22]
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`
2
9
 
3
10
  ## 2.0.0 [2021-09-13]
4
11
 
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 2.0.0
67
+ gem install influxdb-client -v 2.1.0
68
68
  ```
69
69
 
70
70
  For management API:
71
71
 
72
72
  ```
73
- gem install influxdb-client-apis -v 2.0.0
73
+ gem install influxdb-client-apis -v 2.1.0
74
74
  ```
75
75
 
76
76
  ## Usage
@@ -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.health` method. That is equivalent of the [influx ping](https://v2.docs.influxdata.com/v2.0/reference/cli/influx/ping/).
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
 
@@ -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.1.0.pre.3380
4
+ version: 2.1.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-09-13 00:00:00.000000000 Z
11
+ date: 2021-10-22 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,9 +185,9 @@ 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: 1.3.1
190
+ version: '0'
190
191
  requirements: []
191
192
  rubygems_version: 3.0.3.1
192
193
  signing_key: