influxdb-client 2.1.0.pre.3409 → 2.2.0.pre.3845

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: '08a280cc5c4053e62531d6f2859dc7bebfe96b7a65ea2a1741b8b7ede68d0023'
4
- data.tar.gz: e58d5f43ca4d789948adb50441f2fec8b2a62eeda084543eacac837d84e7caa7
3
+ metadata.gz: e0e228772c8d102ecf07e3179adde5114ba29e2a6e8e50e2e6e3f7b24afbf16f
4
+ data.tar.gz: 5a266a027f3b789c68c65e3e21ddd551a307eff3747c65b47cf1f85e96da1f05
5
5
  SHA512:
6
- metadata.gz: d0cb88c00590fa1512fa83290d1fb050a2c537f097370a6f466708235f9f62f755cdbe43bb48a16f83f5e327e257499510af27852e6b8da9e6d12f35e750ac99
7
- data.tar.gz: 581679b325261a29d8dc5edf43f24ae104cb2a333df902555b16192a8ba8148ddc262cce79752371b792aa51316395f4e9268093595b54842c3a474588549253
6
+ metadata.gz: 796c53b19fabae84db3d8333abc9d0246c794c80c63f8349c0464fba4a5d3576edb00e7c243806862f2e9859430ac82a236b983a91aa5cfdeb10fc5f90be671c
7
+ data.tar.gz: 87722335447bf97002d60a1221927ab2dd8c06cfdeb64ab7e2f8f953bb5b6dc9006412b243b9b0e0a00263a2f2acfb18e91f96e7b7c4eca6789b5afb0070fd87
data/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
- ## 2.1.0 [unreleased]
1
+ ## 2.2.0 [unreleased]
2
+
3
+ ## 2.1.0 [2021-10-22]
4
+
5
+ ### Features
6
+ 1. [#93](https://github.com/influxdata/influxdb-client-ruby/pull/93): Add `PingApi` to check status of OSS and Cloud instance
2
7
 
3
8
  ### CI
4
9
  1. [#91](https://github.com/influxdata/influxdb-client-ruby/pull/91): Switch to next-gen CircleCI's convenience images
10
+ 1. [#95](https://github.com/influxdata/influxdb-client-ruby/pull/95): Update `jruby` to `9.3.1.0-jdk11`
5
11
 
6
12
  ## 2.0.0 [2021-09-13]
7
13
 
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
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '2.1.0'.freeze
22
+ VERSION = '2.2.0'.freeze
23
23
  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.3409
4
+ version: 2.2.0.pre.3845
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