influxdb 0.6.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +92 -0
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +34 -0
- data/README.md +80 -34
- data/Rakefile +1 -1
- data/bin/provision.sh +3 -3
- data/influxdb.gemspec +2 -2
- data/lib/influxdb/client.rb +15 -9
- data/lib/influxdb/client/http.rb +11 -1
- data/lib/influxdb/config.rb +7 -5
- data/lib/influxdb/errors.rb +1 -0
- data/lib/influxdb/point_value.rb +4 -1
- data/lib/influxdb/query/batch.rb +9 -3
- data/lib/influxdb/query/cluster.rb +2 -2
- data/lib/influxdb/query/continuous_query.rb +1 -1
- data/lib/influxdb/query/core.rb +11 -7
- data/lib/influxdb/query/database.rb +2 -2
- data/lib/influxdb/query/series.rb +6 -2
- data/lib/influxdb/query/user.rb +8 -8
- data/lib/influxdb/timestamp_conversion.rb +52 -12
- data/lib/influxdb/version.rb +1 -1
- data/lib/influxdb/writer/async.rb +38 -11
- data/lib/influxdb/writer/udp.rb +3 -0
- data/spec/influxdb/cases/async_client_spec.rb +59 -35
- data/spec/influxdb/cases/query_cluster_spec.rb +3 -3
- data/spec/influxdb/cases/query_continuous_query_spec.rb +1 -1
- data/spec/influxdb/cases/query_database_spec.rb +4 -4
- data/spec/influxdb/cases/query_series_spec.rb +24 -8
- data/spec/influxdb/cases/query_user_spec.rb +8 -8
- data/spec/influxdb/cases/querying_issue_7000_spec.rb +1 -1
- data/spec/influxdb/cases/querying_spec.rb +1 -1
- data/spec/influxdb/cases/retry_requests_spec.rb +1 -1
- data/spec/influxdb/cases/udp_client_spec.rb +8 -14
- data/spec/influxdb/client_spec.rb +2 -2
- data/spec/influxdb/config_spec.rb +44 -14
- data/spec/influxdb/logging_spec.rb +3 -0
- data/spec/influxdb/point_value_spec.rb +11 -1
- data/spec/influxdb/time_conversion_spec.rb +19 -0
- data/spec/smoke/smoke_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -4
- metadata +13 -14
- data/.travis.yml +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4526b81c8b4e67ca797482a71d10df463feb3c2a6b2750f6038ab6a12d8b6723
|
4
|
+
data.tar.gz: b55ad197088776641d54822d6cada8b57428ddbd00e3441e46ffa841b27a24d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18c2cc024f308f89066f552826a2072904071ca3df33bc47cb4b4476712a9d3d744055667a21791d4eb1b3d521c2de7ba6b1c99d3491e4953287cee332a1b39
|
7
|
+
data.tar.gz: af2a5856340cd70147f95917784ae700e7ea68e53d9de38c115c4e8c4552f74cdb5dcdadb278aa569c4f6b367b3a10c56a9e54ab27ac808252617cd22adf6717
|
@@ -0,0 +1,92 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
# workflow_dispatch enables running workflow manually
|
4
|
+
on: [push, pull_request, workflow_dispatch]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
rubocop:
|
8
|
+
name: RuboCop
|
9
|
+
runs-on: ${{ matrix.os }}
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
os: [ubuntu-20.04]
|
14
|
+
ruby: [2.7]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
bundler-cache: true
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
- run: bundle exec rake rubocop
|
22
|
+
|
23
|
+
specs:
|
24
|
+
name: ${{ matrix.os }} ${{ matrix.ruby }}
|
25
|
+
runs-on: ${{ matrix.os }}
|
26
|
+
strategy:
|
27
|
+
fail-fast: false
|
28
|
+
matrix:
|
29
|
+
os:
|
30
|
+
- ubuntu-16.04
|
31
|
+
- ubuntu-18.04
|
32
|
+
- ubuntu-20.04
|
33
|
+
ruby:
|
34
|
+
- 2.3
|
35
|
+
- 2.4
|
36
|
+
- 2.5
|
37
|
+
- 2.6
|
38
|
+
- 2.7
|
39
|
+
# YAML gotcha: https://github.com/actions/runner/issues/849
|
40
|
+
- '3.0'
|
41
|
+
- head
|
42
|
+
include:
|
43
|
+
- os: ubuntu-20.04
|
44
|
+
ruby: jruby-9.1
|
45
|
+
jruby_opts: '--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
46
|
+
allow-failure: true
|
47
|
+
- os: ubuntu-20.04
|
48
|
+
ruby: jruby-9.2
|
49
|
+
jruby_opts: '--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
50
|
+
allow-failure: true
|
51
|
+
- os: ubuntu-20.04
|
52
|
+
ruby: jruby-head
|
53
|
+
jruby_opts: '--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
54
|
+
allow-failure: true
|
55
|
+
steps:
|
56
|
+
- uses: actions/checkout@v2
|
57
|
+
- uses: ruby/setup-ruby@v1
|
58
|
+
with:
|
59
|
+
bundler-cache: true
|
60
|
+
ruby-version: ${{ matrix.ruby }}
|
61
|
+
- run: bundle exec rake
|
62
|
+
continue-on-error: ${{ matrix.allow-failure || false }}
|
63
|
+
|
64
|
+
smoketests:
|
65
|
+
name: smoketest with influx ${{ matrix.influx_version }}
|
66
|
+
runs-on: ubuntu-20.04
|
67
|
+
strategy:
|
68
|
+
fail-fast: false
|
69
|
+
matrix:
|
70
|
+
include:
|
71
|
+
- { ruby: 2.7, influx_version: 1.0.2, pkghash: 88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037 }
|
72
|
+
- { ruby: 2.7, influx_version: 1.1.5, pkghash: 0ecb9385cc008f6e5094e6e8f8ea70522023a16d4397e401898f3973176d3b21 }
|
73
|
+
- { ruby: 2.7, influx_version: 1.2.4, pkghash: 2fac8391e04aa1bec9151e8f0d8f18df030c866af2b4963ab7d86c6ddc172182 }
|
74
|
+
- { ruby: 2.7, influx_version: 1.3.8, pkghash: 35c9cb2943bbde04aa5e94ad6d8caf5fc9b1480bdbcde7c34078de135cc4f788 }
|
75
|
+
- { ruby: 2.7, influx_version: 1.4.3, pkghash: 0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359 }
|
76
|
+
- { ruby: 2.7, influx_version: 1.5.4, pkghash: fa6f8d3196d13ffc376d533581b534692c738181ce3427c53484c138d9e6b902 }
|
77
|
+
- { ruby: 2.7, influx_version: 1.6.4, pkghash: dbfa13a0f9e38a8e7b19294c30144903bb681ac0aba0a3a8f4f349c37d5de5f9 }
|
78
|
+
- { ruby: 2.7, influx_version: 1.7.9, pkghash: 02759d70cef670d336768fd38a9cf2f046a1bf40618be78ba215e7ce75b5075f }
|
79
|
+
- { ruby: 2.7, influx_version: nightly, channel: nightlies, allow-failure: true }
|
80
|
+
env:
|
81
|
+
influx_version: ${{ matrix.influx_version }}
|
82
|
+
pkghash: ${{ matrix.pkghash }}
|
83
|
+
channel: ${{ matrix.channel }}
|
84
|
+
steps:
|
85
|
+
- uses: actions/checkout@v2
|
86
|
+
- uses: ruby/setup-ruby@v1
|
87
|
+
with:
|
88
|
+
bundler-cache: true
|
89
|
+
ruby-version: ${{ matrix.ruby }}
|
90
|
+
- run: bin/provision.sh
|
91
|
+
- run: bundle exec rake spec
|
92
|
+
continue-on-error: ${{ matrix.allow-failure || false }}
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,40 @@
|
|
2
2
|
|
3
3
|
For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/commits/master).
|
4
4
|
|
5
|
+
## v0.8.1, release 2021-02-17
|
6
|
+
|
7
|
+
- Ensure workers can send data popped off the queue at shutdown (#239,
|
8
|
+
@onlynone)
|
9
|
+
- Add support for special characters in password when using url keyword (#242,
|
10
|
+
@swistak35)
|
11
|
+
- Add Ruby 3.0 support (#249, @dentarg, @paul and @track8)
|
12
|
+
- Support characters that need quoting for usernames and database names (#248, @estheruary)
|
13
|
+
|
14
|
+
## v0.8.0, released 2020-02-05
|
15
|
+
|
16
|
+
- Allow dropping of specific series from specific DBs (#233, @cantino)
|
17
|
+
- Add support for MRI 2.7 (#235, @jeffkowalski)
|
18
|
+
- Raise a LineProtocolError if attempting to write empty values as field
|
19
|
+
set is required. This adds descriptive feedback to the error "unable to
|
20
|
+
parse '{series},{tags} ': invalid field format" (#236, @todtb)
|
21
|
+
- Add support for configuring HTTP Proxy (#238, @epchris)
|
22
|
+
|
23
|
+
## v0.7.0, released 2019-01-11
|
24
|
+
|
25
|
+
- Drop support for Ruby 2.2, since Bundler dropped it and we want to use
|
26
|
+
Bundler in the development cycle as well.
|
27
|
+
- Fix issue with tag values ending in a backslash.
|
28
|
+
|
29
|
+
## v0.6.4, releases 2018-12-02
|
30
|
+
|
31
|
+
- Fix newly introduced `InfluxDB.now(precision)` for precisions larger
|
32
|
+
than "s".
|
33
|
+
|
34
|
+
## v0.6.3, released 2018-11-30
|
35
|
+
|
36
|
+
- Added `InfluxDB.now(precision)` and `InfluxDB::Client#now` as companions
|
37
|
+
to `InfluxDB.convert_timestamp`.
|
38
|
+
|
5
39
|
## v0.6.2, released 2018-11-30
|
6
40
|
|
7
41
|
- Added `InfluxDB.convert_timestamp` utility to convert a `Time` to a
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# influxdb-ruby
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/influxdb.svg)](https://badge.fury.io/rb/influxdb)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/influxdata/influxdb-ruby/workflows/Tests/badge.svg)](https://github.com/influxdata/influxdb-ruby/actions)
|
5
5
|
|
6
6
|
The official Ruby client library for [InfluxDB](https://influxdata.com/time-series-platform/influxdb/).
|
7
7
|
Maintained by [@toddboom](https://github.com/toddboom) and [@dmke](https://github.com/dmke).
|
8
8
|
|
9
|
+
#### Note: This library is for use with InfluxDB 1.x. For connecting to InfluxDB 2.x instances, please use the [influxdb-client-ruby](https://github.com/influxdata/influxdb-client-ruby) client.
|
10
|
+
|
9
11
|
## Contents
|
10
12
|
|
11
13
|
- [Platform support](#platform-support)
|
@@ -14,7 +16,7 @@ Maintained by [@toddboom](https://github.com/toddboom) and [@dmke](https://githu
|
|
14
16
|
- [Usage](#usage)
|
15
17
|
- [Creating a client](#creating-a-client)
|
16
18
|
- [Writing data](#writing-data)
|
17
|
-
|
19
|
+
- [A Note About Time Precision](#a-note-about-time-precision)
|
18
20
|
- [Querying](#querying)
|
19
21
|
- [Advanced Topics](#advanced-topics)
|
20
22
|
- [Administrative tasks](#administrative-tasks)
|
@@ -39,8 +41,10 @@ Maintained by [@toddboom](https://github.com/toddboom) and [@dmke](https://githu
|
|
39
41
|
|
40
42
|
## Ruby support
|
41
43
|
|
42
|
-
Since v0.
|
43
|
-
|
44
|
+
Since v0.7.0, this gem requires Ruby >= 2.3.0. MRI 2.2 *should* still work,
|
45
|
+
however we are unable to test this properly, since our toolchain (Bundler)
|
46
|
+
has dropped support for it. Support for MRI < 2.2 is still available in the
|
47
|
+
v0.3.x series, see [stable-03 branch](https://github.com/influxdata/influxdb-ruby/tree/stable-03)
|
44
48
|
for documentation.
|
45
49
|
|
46
50
|
## Installation
|
@@ -92,6 +96,21 @@ url = "https://influxdb.example.com:8086/database_name?open_timeout=3"
|
|
92
96
|
influxdb = InfluxDB::Client.new url: url, open_timeout: 10
|
93
97
|
```
|
94
98
|
|
99
|
+
#### Using a custom HTTP Proxy
|
100
|
+
|
101
|
+
By default, the `Net::HTTP` proxy behavior is used (see [Net::HTTP Proxy][proxy])
|
102
|
+
You can optionally set a proxy address and port via the `proxy_addr` and
|
103
|
+
`proxy_port` options:
|
104
|
+
|
105
|
+
``` ruby
|
106
|
+
influxdb = InfluxDB::Client.new database,
|
107
|
+
host: "influxdb.domain.com",
|
108
|
+
proxy_addr: "your.proxy.addr",
|
109
|
+
proxy_port: 8080
|
110
|
+
```
|
111
|
+
|
112
|
+
[proxy]: https://docs.ruby-lang.org/en/2.7.0/Net/HTTP.html#class-Net::HTTP-label-Proxies
|
113
|
+
|
95
114
|
### Writing data
|
96
115
|
|
97
116
|
Write some data:
|
@@ -145,34 +164,8 @@ influxdb.write_point(name, data)
|
|
145
164
|
influxdb.write_point(name, data, time_precision)
|
146
165
|
```
|
147
166
|
|
148
|
-
|
149
|
-
|
150
|
-
The default precision in this gem is `"s"` (second), as Ruby's `Time#to_i`
|
151
|
-
operates on this resolution.
|
152
|
-
|
153
|
-
If you write data points with sub-second resolution, you _have_ to configure
|
154
|
-
your client instance with a more granular `time_precision` option **and** you
|
155
|
-
need to provide timestamp values which reflect this precision. **If you don't do
|
156
|
-
this, your points will be squashed!**
|
157
|
-
|
158
|
-
> A point is uniquely identified by the measurement name, tag set, and
|
159
|
-
> timestamp. If you submit a new point with the same measurement, tag set, and
|
160
|
-
> timestamp as an existing point, the field set becomes the union of the old
|
161
|
-
> field set and the new field set, where any ties go to the new field set. This
|
162
|
-
> is the intended behavior.
|
163
|
-
|
164
|
-
See [How does InfluxDB handle duplicate points?][docs-faq] for details.
|
165
|
-
|
166
|
-
For example, this is how to specify millisecond precision (which moves the
|
167
|
-
pitfall from the second- to the millisecond barrier):
|
168
|
-
|
169
|
-
```ruby
|
170
|
-
influxdb = InfluxDB::Client.new(time_precision: "ms")
|
171
|
-
time = (Time.now.to_r * 1000).to_i
|
172
|
-
# A faster, albeit less readable alternative:
|
173
|
-
# time = Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)
|
174
|
-
influxdb.write_point("foobar", { values: { n: 42 }, timestamp: time })
|
175
|
-
```
|
167
|
+
> **Attention:** Please also read the
|
168
|
+
> [note about time precision](#a-note-about-time-precision) below.
|
176
169
|
|
177
170
|
Allowed values for `time_precision` are:
|
178
171
|
|
@@ -219,7 +212,7 @@ influxdb = InfluxDB::Client.new {
|
|
219
212
|
|
220
213
|
data = {
|
221
214
|
values: { value: 0 },
|
222
|
-
tags: { foo: 'bar', bar: 'baz' }
|
215
|
+
tags: { foo: 'bar', bar: 'baz' },
|
223
216
|
timestamp: Time.now.to_i
|
224
217
|
}
|
225
218
|
|
@@ -304,7 +297,10 @@ async_options = {
|
|
304
297
|
# checking if there are new jobs in the queue
|
305
298
|
sleep_interval: 5,
|
306
299
|
# whether client will block if queue is full
|
307
|
-
block_on_full_queue: false
|
300
|
+
block_on_full_queue: false,
|
301
|
+
# Max time (in seconds) the main thread will wait for worker threads to stop
|
302
|
+
# on shutdown. Defaults to 2x sleep_interval.
|
303
|
+
shutdown_timeout: 10
|
308
304
|
}
|
309
305
|
|
310
306
|
influxdb = InfluxDB::Client.new database, async: async_options
|
@@ -337,6 +333,56 @@ influxdb = InfluxDB::Client.new(
|
|
337
333
|
influxdb.write_point('hitchhiker', { values: { value: 666 } })
|
338
334
|
```
|
339
335
|
|
336
|
+
### A Note About Time Precision
|
337
|
+
|
338
|
+
The default precision in this gem is `"s"` (second), as Ruby's `Time#to_i`
|
339
|
+
operates on this resolution.
|
340
|
+
|
341
|
+
If you write data points with sub-second resolution, you _have_ to configure
|
342
|
+
your client instance with a more granular `time_precision` option **and** you
|
343
|
+
need to provide timestamp values which reflect this precision. **If you don't do
|
344
|
+
this, your points will be squashed!**
|
345
|
+
|
346
|
+
> A point is uniquely identified by the measurement name, tag set, and
|
347
|
+
> timestamp. If you submit a new point with the same measurement, tag set, and
|
348
|
+
> timestamp as an existing point, the field set becomes the union of the old
|
349
|
+
> field set and the new field set, where any ties go to the new field set. This
|
350
|
+
> is the intended behavior.
|
351
|
+
|
352
|
+
See [How does InfluxDB handle duplicate points?][docs-faq] for details.
|
353
|
+
|
354
|
+
For example, this is how to specify millisecond precision (which moves the
|
355
|
+
pitfall from the second- to the millisecond barrier):
|
356
|
+
|
357
|
+
```ruby
|
358
|
+
client = InfluxDB::Client.new(time_precision: "ms")
|
359
|
+
time = (Time.now.to_r * 1000).to_i
|
360
|
+
client.write_point("foobar", { values: { n: 42 }, timestamp: time })
|
361
|
+
```
|
362
|
+
|
363
|
+
For convenience, InfluxDB provides a few helper methods:
|
364
|
+
|
365
|
+
```ruby
|
366
|
+
# to get a timestamp with the precision configured in the client:
|
367
|
+
client.now
|
368
|
+
|
369
|
+
# to get a timestamp with the given precision:
|
370
|
+
InfluxDB.now(time_precision)
|
371
|
+
|
372
|
+
# to convert a Time into a timestamp with the given precision:
|
373
|
+
InfluxDB.convert_timestamp(Time.now, time_precision)
|
374
|
+
```
|
375
|
+
|
376
|
+
As with `client.write_point`, allowed values for `time_precision` are:
|
377
|
+
|
378
|
+
- `"ns"` or `nil` for nanosecond
|
379
|
+
- `"u"` for microsecond
|
380
|
+
- `"ms"` for millisecond
|
381
|
+
- `"s"` for second
|
382
|
+
- `"m"` for minute
|
383
|
+
- `"h"` for hour
|
384
|
+
|
385
|
+
[docs-faq]: http://docs.influxdata.com/influxdb/v1.7/troubleshooting/frequently-asked-questions/#how-does-influxdb-handle-duplicate-points
|
340
386
|
|
341
387
|
### Querying
|
342
388
|
|
data/Rakefile
CHANGED
data/bin/provision.sh
CHANGED
@@ -36,7 +36,7 @@ echo "-- Download has SHA256 hash: ${sha2_sum}"
|
|
36
36
|
echo "== Installing"
|
37
37
|
|
38
38
|
sudo dpkg -i "${HOME}/${package_name}"
|
39
|
-
sudo
|
39
|
+
sudo service influxdb start || true
|
40
40
|
|
41
41
|
echo "-- waiting for daemon to start"
|
42
42
|
while ! curl --head --fail --silent http://localhost:8086/ping; do
|
@@ -63,7 +63,7 @@ echo "-- grant access"
|
|
63
63
|
|
64
64
|
echo "== Download and import NOAA sample data"
|
65
65
|
|
66
|
-
curl https://s3
|
66
|
+
curl https://s3.amazonaws.com/noaa.water-database/NOAA_data.txt > noaa.txt
|
67
67
|
/usr/bin/influx -import -path noaa.txt -precision s
|
68
68
|
|
69
69
|
echo "-- grant access"
|
@@ -78,7 +78,7 @@ if [ ! -f /etc/influxdb/influxdb.conf ]; then
|
|
78
78
|
fi
|
79
79
|
|
80
80
|
sudo sed -i 's/auth-enabled = false/auth-enabled = true/' /etc/influxdb/influxdb.conf
|
81
|
-
sudo
|
81
|
+
sudo service influxdb restart || true
|
82
82
|
|
83
83
|
echo "-- waiting for daemon to restart"
|
84
84
|
while ! curl --head --fail --silent http://localhost:8086/ping; do
|
data/influxdb.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.required_ruby_version = ">= 2.2.0"
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.6"
|
24
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
24
|
+
spec.add_development_dependency "rubocop", "~> 0.61.1"
|
25
25
|
spec.add_development_dependency "webmock", "~> 3.0"
|
26
26
|
end
|
data/lib/influxdb/client.rb
CHANGED
@@ -48,10 +48,10 @@ module InfluxDB
|
|
48
48
|
# +:verify_ssl+:: verify ssl server certificate?
|
49
49
|
# +:ssl_ca_cert+:: ssl CA certificate, chainfile or CA path.
|
50
50
|
# The system CA path is automatically included
|
51
|
-
# +:retry
|
51
|
+
# +:retry+:: number of times a failed request should be retried. Defaults to infinite.
|
52
52
|
def initialize(database = nil, **opts)
|
53
53
|
opts[:database] = database if database.is_a? String
|
54
|
-
@config = InfluxDB::Config.new(opts)
|
54
|
+
@config = InfluxDB::Config.new(**opts)
|
55
55
|
@stopped = false
|
56
56
|
@writer = find_writer
|
57
57
|
|
@@ -59,17 +59,23 @@ module InfluxDB
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def stop!
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
writer.worker.stop!
|
62
|
+
if @writer == self
|
63
|
+
@stopped = true
|
64
|
+
else
|
65
|
+
@writer.stop!
|
67
66
|
end
|
68
|
-
@stopped = true
|
69
67
|
end
|
70
68
|
|
71
69
|
def stopped?
|
72
|
-
@
|
70
|
+
if @writer == self
|
71
|
+
@stopped
|
72
|
+
else
|
73
|
+
@writer.stopped?
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def now
|
78
|
+
InfluxDB.now(config.time_precision)
|
73
79
|
end
|
74
80
|
|
75
81
|
private
|
data/lib/influxdb/client/http.rb
CHANGED
@@ -45,7 +45,7 @@ module InfluxDB
|
|
45
45
|
retry_count = 0
|
46
46
|
|
47
47
|
begin
|
48
|
-
http =
|
48
|
+
http = build_http(host, config.port)
|
49
49
|
http.open_timeout = config.open_timeout
|
50
50
|
http.read_timeout = config.read_timeout
|
51
51
|
|
@@ -133,6 +133,16 @@ module InfluxDB
|
|
133
133
|
end
|
134
134
|
store
|
135
135
|
end
|
136
|
+
|
137
|
+
# Builds an http instance, taking into account any configured
|
138
|
+
# proxy configuration
|
139
|
+
def build_http(host, port)
|
140
|
+
if config.proxy_addr
|
141
|
+
Net::HTTP.new(host, port, config.proxy_addr, config.proxy_port)
|
142
|
+
else
|
143
|
+
Net::HTTP.new(host, port)
|
144
|
+
end
|
145
|
+
end
|
136
146
|
end
|
137
147
|
# rubocop:enable Metrics/MethodLength
|
138
148
|
# rubocop:enable Metrics/AbcSize
|