influxdb-client 1.0.0.beta → 1.0.0.pre.3

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: e203e9d1b0a4b60718bf0dfaaf61b51ecba01a8272d6d87b27961a2ee648e19e
4
- data.tar.gz: 3ca6b8adf3d93095151f49c19707c01825935f7c2715af85e701550493f26c1d
3
+ metadata.gz: efaf2b6d0ecb5fb8afb2f89ae5f5453ae503d0752a84c18f0778f1b897852a4c
4
+ data.tar.gz: 1cd9c661e1ebaeb5766884dbbf8d5b4bfaac4f80e6d49e9a0be7c35e4cc82c78
5
5
  SHA512:
6
- metadata.gz: d35c17008c9cafaa987bc60373fa124ba11bde79e6b92b7f09de611e43e1031831a194d4a626791537d140926a2722a63588de9730592ab86cc7bfd4c7b49658
7
- data.tar.gz: 33ce6e893e185b74d30210ab14494ee759f853678f12579ca982f065b6923091833e45032bf57ad654039416d5ba89c46cd0c6fea21fe3694aece586d75ce56c
6
+ metadata.gz: 76084520edb946cb367ea1bc7e30671b8921888c51631be40564510cb63993c8e8bf789caf7bc0cb6c7f363d249ba2a88805c59b4b8d3be18790951a65b4859a
7
+ data.tar.gz: 3e1c904a3e3e2a2753f5140580fdfe382908cfc5bce650387a9b0f3e513f21d848a669c0d223c2cc79b0be07d09b7374ecc9de539d0461921202412b2528cbfa
@@ -23,33 +23,28 @@
23
23
  version: 2.1
24
24
 
25
25
  commands:
26
- influxdb-onboarding:
26
+ influxdb-restart:
27
27
  steps:
28
28
  - run:
29
- name: "Post onBoarding request to InfluxDB 2"
30
- command: ./bin/influxdb-onboarding.sh
29
+ name: "Start InfluxDB 2"
30
+ command: ./bin/influxdb-restart.sh
31
31
  prepare:
32
32
  description: "Prepare environment to tests"
33
33
  steps:
34
34
  - checkout
35
- - influxdb-onboarding
35
+ - influxdb-restart
36
36
  test:
37
- parameters:
38
- ruby-image:
39
- type: string
40
37
  steps:
41
38
  - restore_cache:
42
39
  name: Restoring Gem Cache
43
40
  keys:
44
- - &cache-key gem-cache-{{ checksum "influxdb-client.gemspec" }}-<< parameters.ruby-image >>
45
- - gem-cache-{{ checksum "influxdb-client.gemspec" }}
41
+ - &cache-key gem-cache-{{ checksum "influxdb-client.gemspec" }}
46
42
  - gem-cache-
47
43
  - run:
48
44
  name: Install dependencies
49
45
  command: |
50
46
  gem install bundler
51
- bundle config set path 'vendor/bundle'
52
- bundle install --jobs=4 --retry=3
47
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
53
48
  - run:
54
49
  name: Static code analyze
55
50
  command: |
@@ -72,75 +67,40 @@ commands:
72
67
 
73
68
  jobs:
74
69
  tests-ruby:
75
- parameters:
76
- ruby-image:
77
- type: string
78
- default: &default-ruby-image "circleci/ruby:2.6-stretch"
79
- influxdb-image:
80
- type: string
81
- default: &default-influxdb-image "influxdb:2.0.0-beta"
82
- docker:
83
- - image: << parameters.ruby-image >>
84
- - image: &influx-image quay.io/influxdb/<< parameters.influxdb-image >>
70
+ machine: true
85
71
  steps:
86
72
  - prepare
87
- - test:
88
- ruby-image: << parameters.ruby-image >>
73
+ - test
89
74
  - storing-test-results
90
75
 
91
76
  deploy-preview:
92
- parameters:
93
- influxdb-image:
94
- type: string
95
- default: *default-influxdb-image
96
- docker:
97
- - image: *default-ruby-image
98
- - image: *influx-image
77
+ machine: true
99
78
  steps:
100
79
  - run:
101
80
  name: Early return if this build is from a forked repository
102
81
  command: |
103
- if [[ $CIRCLE_PROJECT_USERNAME != "influxdata" ]]; then
82
+ if [[ $CIRCLE_PROJECT_USERNAME != "bonitoo-io" ]]; then
104
83
  echo "Nothing to do for forked repositories, so marking this step successful"
105
84
  circleci step halt
106
85
  fi
107
86
  - checkout
108
87
  - run:
109
- name: Setup Rubygems
110
- command: bash .circleci/setup-rubygems.sh
111
- - run:
112
- name: Build a Gem bundle
88
+ name: Build a gem bundle
113
89
  command: |
114
90
  gem build influxdb-client.gemspec
91
+ GEM_FILE_NAME=`find . -name 'influxdb-client*.pre.*.gem'`
115
92
  - run:
116
- name: Deploy pre-release into https://rubygems.org
93
+ name: Deploy $GEM_FILE_NAME into https://rubygems.org
117
94
  command: |
118
- gem push influxdb-client-*.pre.$CIRCLE_BUILD_NUM.gem
95
+ echo "TODO"
119
96
  workflows:
120
97
  version: 2
121
98
  build:
122
99
  jobs:
123
- - tests-ruby:
124
- name: ruby-2.7
125
- ruby-image: "circleci/ruby:2.7-buster"
126
- - tests-ruby:
127
- name: ruby-2.6
128
- - tests-ruby:
129
- name: ruby-2.6-nightly
130
- influxdb-image: "influx:nightly"
131
- - tests-ruby:
132
- name: ruby-2.5
133
- ruby-image: "circleci/ruby:2.5-stretch"
134
- - tests-ruby:
135
- name: ruby-2.4
136
- ruby-image: "circleci/ruby:2.4-stretch"
100
+ - tests-ruby
137
101
  - deploy-preview:
138
102
  requires:
139
- - ruby-2.7
140
- - ruby-2.6
141
- - ruby-2.6-nightly
142
- - ruby-2.5
143
- - ruby-2.4
103
+ - tests-ruby
144
104
  filters:
145
105
  branches:
146
106
  only: master
@@ -154,4 +114,4 @@ workflows:
154
114
  only:
155
115
  - master
156
116
  jobs:
157
- - tests-ruby
117
+ - tests-ruby
data/.gitignore CHANGED
@@ -10,5 +10,4 @@
10
10
  /Gemfile.lock
11
11
  /test/reports/
12
12
  .rakeTasks
13
- /influxdb-client-*.gem
14
- /TAGS
13
+ /influxdb-client-*.gem
File without changes
data/README.md CHANGED
@@ -1,21 +1,19 @@
1
1
  # influxdb-client-ruby
2
2
 
3
- [![CircleCI](https://circleci.com/gh/influxdata/influxdb-client-ruby.svg?style=svg)](https://circleci.com/gh/influxdata/influxdb-client-ruby)
4
- [![codecov](https://codecov.io/gh/influxdata/influxdb-client-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/influxdata/influxdb-client-ruby)
5
- [![Gem Version](https://badge.fury.io/rb/influxdb-client.svg)](https://badge.fury.io/rb/influxdb-client)
6
- [![License](https://img.shields.io/github/license/influxdata/influxdb-client-ruby.svg)](https://github.com/influxdata/influxdb-client-ruby/blob/master/LICENSE)
7
- [![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-client-ruby.svg)](https://github.com/influxdata/influxdb-client-ruby/issues)
8
- [![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/influxdata/influxdb-client-ruby.svg)](https://github.com/influxdata/influxdb-client-ruby/pulls)
9
- [![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://www.influxdata.com/slack)
3
+ [![CircleCI](https://circleci.com/gh/bonitoo-io/influxdb-client-ruby.svg?style=svg)](https://circleci.com/gh/bonitoo-io/influxdb-client-ruby)
4
+ [![codecov](https://codecov.io/gh/bonitoo-io/influxdb-client-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/bonitoo-io/influxdb-client-ruby)
5
+ [![Gem Version](https://badge.fury.io/rb/influxdb_client.svg)](https://badge.fury.io/rb/influxdb_client)
6
+ [![License](https://img.shields.io/github/license/bonitoo-io/influxdb-client-ruby.svg)](https://github.com/bonitoo-io/influxdb-client-ruby/blob/master/LICENSE)
7
+ [![GitHub issues](https://img.shields.io/github/issues-raw/bonitoo-io/influxdb-client-ruby.svg)](https://github.com/bonitoo-io/influxdb-client-ruby/issues)
8
+ [![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/bonitoo-io/influxdb-client-ruby.svg)](https://github.com/bonitoo-io/influxdb-client-ruby/pulls)
10
9
 
11
10
  This repository contains the reference Ruby client for the InfluxDB 2.0.
12
11
 
13
12
  #### Note: This library is for use with InfluxDB 2.x. For connecting to InfluxDB 1.x instances, please use the [influxdb-ruby](https://github.com/influxdata/influxdb-ruby) client.
14
- #### Disclaimer: This library is a work in progress and should not be considered production ready yet.
15
13
 
16
14
  ## Installation
17
15
 
18
- The InfluxDB 2 client is bundled as a gem and is hosted on [Rubygems](https://rubygems.org/gems/influxdb-client).
16
+ The InfluxDB 2 client is bundled as a gem and is hosted on [Rubygems](https://rubygems.org/gems/mongo).
19
17
 
20
18
  ### Install the Gem
21
19
 
@@ -24,7 +22,7 @@ The client can be installed manually or with bundler.
24
22
  To install the client gem manually:
25
23
 
26
24
  ```
27
- gem install influxdb-client -v 1.0.0.beta
25
+ gem install influxdb_client --version 1.0.0 --pre
28
26
  ```
29
27
 
30
28
  ## Usage
@@ -34,7 +32,7 @@ gem install influxdb-client -v 1.0.0.beta
34
32
  Use **InfluxDB::Client** to create a client connected to a running InfluxDB 2 instance.
35
33
 
36
34
  ```ruby
37
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token')
35
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token')
38
36
  ```
39
37
 
40
38
  #### Client Options
@@ -48,22 +46,21 @@ client = InfluxDB2::Client.new('https://localhost:9999', 'my-token')
48
46
  | write_timeout | Number of seconds to wait for one block of data to be written | Integer | 10 |
49
47
  | read_timeout | Number of seconds to wait for one block of data to be read | Integer | 10 |
50
48
  | max_redirect_count | Maximal number of followed HTTP redirects | Integer | 10 |
51
- | use_ssl | Turn on/off SSL for HTTP communication | bool | true |
52
49
 
53
50
  ```ruby
54
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
55
- bucket: 'my-bucket',
56
- org: 'my-org',
57
- precision: InfluxDB2::WritePrecision::NANOSECOND)
51
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
52
+ bucket: 'my-bucket',
53
+ org: 'my-org',
54
+ precision: InfluxDB::WritePrecision::NANOSECOND)
58
55
  ```
59
56
 
60
57
  ### Writing data
61
58
 
62
59
  ```ruby
63
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
60
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
64
61
  bucket: 'my-bucket',
65
62
  org: 'my-org',
66
- precision: InfluxDB2::WritePrecision::NANOSECOND)
63
+ precision: InfluxDB::WritePrecision::NANOSECOND)
67
64
 
68
65
  write_api = client.create_write_api
69
66
  write_api.write(data: 'h2o,location=west value=33i 15')
@@ -73,20 +70,20 @@ write_api.write(data: 'h2o,location=west value=33i 15')
73
70
 
74
71
  Configure default time precision:
75
72
  ```ruby
76
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
73
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
77
74
  bucket: 'my-bucket',
78
75
  org: 'my-org',
79
- precision: InfluxDB2::WritePrecision::NANOSECOND)
76
+ precision: InfluxDB::WritePrecision::NANOSECOND)
80
77
  ```
81
78
 
82
79
  Configure precision per write:
83
80
  ```ruby
84
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
81
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
85
82
  bucket: 'my-bucket',
86
83
  org: 'my-org')
87
84
 
88
85
  write_api = client.create_write_api
89
- write_api.write(data: 'h2o,location=west value=33i 15', precision: InfluxDB2::WritePrecision::SECOND)
86
+ write_api.write(data: 'h2o,location=west value=33i 15', precision: InfluxDB::WritePrecision::SECOND)
90
87
  ```
91
88
 
92
89
  Allowed values for precision are:
@@ -99,15 +96,15 @@ Allowed values for precision are:
99
96
 
100
97
  Default `bucket` and `organization` destination are configured via `InfluxDB::Client`:
101
98
  ```ruby
102
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
99
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
103
100
  bucket: 'my-bucket',
104
101
  org: 'my-org')
105
102
  ```
106
103
 
107
104
  but there is also possibility to override configuration per write:
108
-
105
+
109
106
  ```ruby
110
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token')
107
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token')
111
108
 
112
109
  write_api = client.create_write_api
113
110
  write_api.write(data: 'h2o,location=west value=33i 15', bucket: 'production-data', org: 'customer-1')
@@ -119,16 +116,16 @@ The data could be written as:
119
116
 
120
117
  1. `String` that is formatted as a InfluxDB's line protocol
121
118
  1. `Hash` with keys: name, tags, fields and time
122
- 1. [Data Point](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb/client/point.rb#L28) structure
119
+ 1. [Data Point](https://github.com/bonitoo-io/influxdb-client-ruby/blob/master/lib/influxdb/client/point.rb#L28) structure
123
120
  1. `Array` of above items
124
121
 
125
122
  ```ruby
126
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
123
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
127
124
  bucket: 'my-bucket',
128
125
  org: 'my-org',
129
- precision: InfluxDB2::WritePrecision::NANOSECOND)
126
+ precision: InfluxDB::WritePrecision::NANOSECOND)
130
127
 
131
- point = InfluxDB2::Point.new(name: 'h2o')
128
+ point = InfluxDB::Point.new(name: 'h2o')
132
129
  .add_tag('location', 'europe')
133
130
  .add_field('level', 2)
134
131
 
@@ -140,17 +137,9 @@ write_api = client.create_write_api
140
137
  write_api.write(data: ['h2o,location=west value=33i 15', point, hash])
141
138
  ```
142
139
 
143
- ## Local tests
144
-
145
- ```
146
- brew install wget # on a mac, if not yet installed!
147
- bin/influxdb-restart.sh
148
- rake test
149
- ```
150
-
151
140
  ## Contributing
152
141
 
153
- Bug reports and pull requests are welcome on GitHub at https://github.com/influxdata/influxdb-client-ruby.
142
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bonitoo-io/influxdb-client-ruby.
154
143
 
155
144
  ## License
156
145
 
@@ -26,13 +26,9 @@ set -e
26
26
  DEFAULT_DOCKER_REGISTRY="quay.io/influxdb/"
27
27
  DOCKER_REGISTRY="${DOCKER_REGISTRY:-$DEFAULT_DOCKER_REGISTRY}"
28
28
 
29
- DEFAULT_INFLUXDB_V2_REPOSITORY="influxdb"
30
- DEFAULT_INFLUXDB_V2_VERSION="2.0.0-beta"
31
- INFLUXDB_V2_REPOSITORY="${INFLUXDB_V2_REPOSITORY:-$DEFAULT_INFLUXDB_V2_REPOSITORY}"
29
+ DEFAULT_INFLUXDB_V2_VERSION="nightly"
32
30
  INFLUXDB_V2_VERSION="${INFLUXDB_V2_VERSION:-$DEFAULT_INFLUXDB_V2_VERSION}"
33
- INFLUXDB_V2_IMAGE=${DOCKER_REGISTRY}${INFLUXDB_V2_REPOSITORY}:${INFLUXDB_V2_VERSION}
34
-
35
- SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
31
+ INFLUXDB_V2_IMAGE=${DOCKER_REGISTRY}influx:${INFLUXDB_V2_VERSION}
36
32
 
37
33
  docker kill influxdb_v2 || true
38
34
  docker rm influxdb_v2 || true
@@ -54,7 +50,17 @@ docker run \
54
50
  --publish 9999:9999 \
55
51
  "${INFLUXDB_V2_IMAGE}"
56
52
 
57
- #
58
- # Post onBoarding request to InfluxDB 2
59
- #
60
- "${SCRIPT_PATH}"/influxdb-onboarding.sh
53
+ echo "Wait to start InfluxDB 2.0"
54
+ wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics
55
+
56
+ echo
57
+ echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
58
+ echo
59
+ curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
60
+ -d '{
61
+ "username": "my-user",
62
+ "password": "my-password",
63
+ "org": "my-org",
64
+ "bucket": "my-bucket",
65
+ "token": "my-token"
66
+ }'
@@ -20,27 +20,26 @@
20
20
 
21
21
  lib = File.expand_path('lib', __dir__)
22
22
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
23
- require 'influxdb2/client/version'
23
+ require 'influxdb/client/version'
24
24
 
25
25
  Gem::Specification.new do |spec|
26
26
  spec.name = 'influxdb-client'
27
- spec.version = ENV['CIRCLE_BUILD_NUM'] ? "#{InfluxDB2::VERSION}-#{ENV['CIRCLE_BUILD_NUM']}" : InfluxDB2::VERSION
27
+ spec.version = ENV['CIRCLE_BUILD_NUM'] ? "#{InfluxDB::VERSION}-#{ENV['CIRCLE_BUILD_NUM']}" : InfluxDB::VERSION
28
28
  spec.authors = ['Jakub Bednar']
29
29
  spec.email = ['jakub.bednar@gmail.com']
30
30
 
31
31
  spec.summary = 'Ruby library for InfluxDB 2.'
32
32
  spec.description = 'This is the official Ruby library for InfluxDB 2.'
33
- spec.homepage = 'https://github.com/influxdata/influxdb-client-ruby'
33
+ spec.homepage = 'https://github.com/bonitoo-io/influxdb-client-ruby'
34
34
  spec.license = 'MIT'
35
35
 
36
36
  spec.metadata['homepage_uri'] = spec.homepage
37
- spec.metadata['source_code_uri'] = 'https://github.com/influxdata/influxdb-client-ruby'
38
- spec.metadata['changelog_uri'] = 'https://raw.githubusercontent.com/influxdata/influxdb-client-ruby/master/CHANGELOG.md'
37
+ spec.metadata['source_code_uri'] = 'https://github.com/bonitoo-io/influxdb-client-ruby'
38
+ spec.metadata['changelog_uri'] = 'https://raw.githubusercontent.com/bonitoo-io/influxdb-client-ruby/master/CHANGELOG.md'
39
39
 
40
40
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
41
41
  spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
42
42
  spec.require_paths = ['lib']
43
- spec.required_ruby_version = '>= 2.2.0'
44
43
 
45
44
  spec.add_development_dependency 'bundler', '~> 2.0'
46
45
  spec.add_development_dependency 'codecov', '~> 0.1.16'
@@ -18,8 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require 'influxdb2/client/version'
22
- require 'influxdb2/client/client'
23
- require 'influxdb2/client/influx_error'
24
- require 'influxdb2/client/write_api'
25
- require 'influxdb2/client/point'
21
+ require 'influxdb/client/version'
22
+ require 'influxdb/client/client'
23
+ require 'influxdb/client/influx_error'
24
+ require 'influxdb/client/write_api'
25
+ require 'influxdb/client/point'
@@ -17,9 +17,8 @@
17
17
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
- require 'net/http'
21
20
 
22
- module InfluxDB2
21
+ module InfluxDB
23
22
  # The client is the entry point to HTTP API defined
24
23
  # in https://github.com/influxdata/influxdb/blob/master/http/swagger.yml.
25
24
  class Client
@@ -29,11 +28,11 @@ module InfluxDB2
29
28
  # Instantiate a new InfluxDB client.
30
29
  #
31
30
  # @example Instantiate a client.
32
- # InfluxDBClient::Client.new(url: 'https://localhost:9999', token: 'my-token')
31
+ # InfluxDBClient::Client.new(url: 'http://localhost:9999', token: 'my-token')
33
32
  #
34
33
  # @param [Hash] options The options to be used by the client.
35
- # @param [String] url InfluxDB URL to connect to (ex. https://localhost:9999).
36
- # @param [String] token Access Token used for authenticating/authorizing the InfluxDB request sent by client.
34
+ # @param [String] url InfluxDB server API url (ex. http://localhost:9999).
35
+ # @param [String] token authentication token
37
36
  #
38
37
  # @option options [String] :bucket the default destination bucket for writes
39
38
  # @option options [String] :org the default organization bucket for writes
@@ -42,7 +41,6 @@ module InfluxDB2
42
41
  # @option options [Integer] :write_timeout Number of seconds to wait for one block of data to be written
43
42
  # @option options [Integer] :read_timeout Number of seconds to wait for one block of data to be read
44
43
  # @option options [Integer] :max_redirect_count Maximal number of followed HTTP redirects
45
- # @option options [bool] :use_ssl Turn on/off SSL for HTTP communication
46
44
  # the body line-protocol
47
45
  def initialize(url, token, options = nil)
48
46
  @options = options ? options.dup : {}
@@ -50,7 +48,7 @@ module InfluxDB2
50
48
  @options[:token] = token if token.is_a? String
51
49
  @closed = false
52
50
 
53
- at_exit { close! }
51
+ at_exit { close }
54
52
  end
55
53
 
56
54
  # Write time series data into InfluxDB thought WriteApi.
@@ -63,7 +61,7 @@ module InfluxDB2
63
61
  # Close all connections into InfluxDB 2.
64
62
  #
65
63
  # @return [ true ] Always true.
66
- def close!
64
+ def close
67
65
  @closed = true
68
66
  true
69
67
  end
@@ -1,4 +1,4 @@
1
- module InfluxDB2
1
+ module InfluxDB
2
2
  # InfluxError that is raised during HTTP communication.
3
3
  class InfluxError < StandardError
4
4
  # HTTP status code