influxdb 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -5
- data/lib/influxdb/version.rb +1 -1
- data/lib/influxdb/writer/async.rb +10 -6
- data/spec/influxdb/cases/async_client_spec.rb +7 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef1ebbbcacc05c56d8bbabdbd22848361b6ac3f6
|
4
|
+
data.tar.gz: 737cc1c7fb163655ccec58afdb6261084646b620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c1e764c646a040c133c7bf9f2ce299fee0da7091a872437ee2586de8496aea944d9994f57aa3b83c30e4cb0ebf297cf69b4e4cbb910d99a1da2cb5b8218cee5
|
7
|
+
data.tar.gz: c753626ee6dde17ed931febfe12656e5d7c3c5ab380ad333f28930d464808595805d12649e908383cf2d7287e9281a17f8b1826f236d912c95aa51ea73c5da59
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
|
|
4
4
|
|
5
5
|
## Unreleased changes
|
6
6
|
|
7
|
+
- None.
|
8
|
+
|
9
|
+
## v0.5.2, released 2017-11-28
|
10
|
+
|
11
|
+
- Add async option to block on full queue (#209, @davemt)
|
12
|
+
|
7
13
|
## v0.5.1, released 2017-10-31
|
8
14
|
|
9
15
|
- Add support for `SHARD DURATION` in retention policy (#203, @ljagiello)
|
data/README.md
CHANGED
@@ -157,7 +157,7 @@ influxdb.write_point(name, data, time_precision)
|
|
157
157
|
>
|
158
158
|
> ```ruby
|
159
159
|
> influxdb = InfluxDB::Client.new time_precision: "ms"
|
160
|
-
> time = (Time.now.to_r *
|
160
|
+
> time = (Time.now.to_r * 1000).to_i
|
161
161
|
> influxdb.write_point("foobar", { values: { n: 42 }, timestamp: time })
|
162
162
|
> ```
|
163
163
|
|
@@ -282,14 +282,16 @@ Using `async: true` is a shortcut for the following:
|
|
282
282
|
``` ruby
|
283
283
|
async_options = {
|
284
284
|
# number of points to write to the server at once
|
285
|
-
max_post_points:
|
285
|
+
max_post_points: 1000,
|
286
286
|
# queue capacity
|
287
|
-
max_queue_size:
|
287
|
+
max_queue_size: 10_000,
|
288
288
|
# number of threads
|
289
|
-
num_worker_threads:
|
289
|
+
num_worker_threads: 3,
|
290
290
|
# max. time (in seconds) a thread sleeps before
|
291
291
|
# checking if there are new jobs in the queue
|
292
|
-
sleep_interval:
|
292
|
+
sleep_interval: 5,
|
293
|
+
# whether client will block if queue is full
|
294
|
+
block_on_full_queue: false
|
293
295
|
}
|
294
296
|
|
295
297
|
influxdb = InfluxDB::Client.new database, async: async_options
|
data/lib/influxdb/version.rb
CHANGED
@@ -34,7 +34,8 @@ module InfluxDB
|
|
34
34
|
:max_post_points,
|
35
35
|
:max_queue_size,
|
36
36
|
:num_worker_threads,
|
37
|
-
:sleep_interval
|
37
|
+
:sleep_interval,
|
38
|
+
:block_on_full_queue
|
38
39
|
|
39
40
|
include InfluxDB::Logging
|
40
41
|
|
@@ -42,17 +43,20 @@ module InfluxDB
|
|
42
43
|
MAX_QUEUE_SIZE = 10_000
|
43
44
|
NUM_WORKER_THREADS = 3
|
44
45
|
SLEEP_INTERVAL = 5
|
46
|
+
BLOCK_ON_FULL_QUEUE = false
|
45
47
|
|
46
48
|
def initialize(client, config)
|
47
49
|
@client = client
|
48
50
|
config = config.is_a?(Hash) ? config : {}
|
49
51
|
|
50
|
-
@max_post_points
|
51
|
-
@max_queue_size
|
52
|
-
@num_worker_threads
|
53
|
-
@sleep_interval
|
52
|
+
@max_post_points = config.fetch(:max_post_points, MAX_POST_POINTS)
|
53
|
+
@max_queue_size = config.fetch(:max_queue_size, MAX_QUEUE_SIZE)
|
54
|
+
@num_worker_threads = config.fetch(:num_worker_threads, NUM_WORKER_THREADS)
|
55
|
+
@sleep_interval = config.fetch(:sleep_interval, SLEEP_INTERVAL)
|
56
|
+
@block_on_full_queue = config.fetch(:block_on_full_queue, BLOCK_ON_FULL_QUEUE)
|
54
57
|
|
55
|
-
|
58
|
+
queue_class = @block_on_full_queue ? SizedQueue : InfluxDB::MaxQueue
|
59
|
+
@queue = queue_class.new max_queue_size
|
56
60
|
|
57
61
|
spawn_threads!
|
58
62
|
end
|
@@ -86,10 +86,11 @@ describe InfluxDB::Client do
|
|
86
86
|
describe "async options" do
|
87
87
|
let(:async_options) do
|
88
88
|
{
|
89
|
-
max_post_points:
|
90
|
-
max_queue_size:
|
91
|
-
num_worker_threads:
|
92
|
-
sleep_interval:
|
89
|
+
max_post_points: 10,
|
90
|
+
max_queue_size: 100,
|
91
|
+
num_worker_threads: 1,
|
92
|
+
sleep_interval: 0.5,
|
93
|
+
block_on_full_queue: false
|
93
94
|
}
|
94
95
|
end
|
95
96
|
|
@@ -100,5 +101,7 @@ describe InfluxDB::Client do
|
|
100
101
|
specify { expect(subject.max_queue_size).to be 100 }
|
101
102
|
specify { expect(subject.num_worker_threads).to be 1 }
|
102
103
|
specify { expect(subject.sleep_interval).to be_within(0.0001).of(0.5) }
|
104
|
+
specify { expect(subject.block_on_full_queue).to be false }
|
105
|
+
specify { expect(subject.queue).to be_kind_of(InfluxDB::MaxQueue) }
|
103
106
|
end
|
104
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|