influxdb 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/README.md +2 -0
- data/influxdb.gemspec +1 -1
- data/lib/influxdb/point_value.rb +6 -5
- data/lib/influxdb/version.rb +1 -1
- data/lib/influxdb/writer/async.rb +1 -1
- data/spec/influxdb/cases/async_client_spec.rb +6 -4
- data/spec/influxdb/worker_spec.rb +10 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48b3b597ccffb495aafb01038b0a00300a5aaf85
|
4
|
+
data.tar.gz: ae802e95ce9675869e5ae482d30d6a46ed7318ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9725f16e1b6cf6b15dfab0b0717a30fff9a1eca6dc7b1b7463adf5a985745ff83c14e90191aa58a06167b6be7bc3e085a79424ce303d78172ef8e7f513816f43
|
7
|
+
data.tar.gz: 6875eff543b72a4791fd8d7e73b0ceef5a079983dfee1356d758ad43a900d88f77f86bbdb3a0d9d789eeceaab576203a015e83e5ae09ad5ebda2ece3fb2fcfc3
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,8 @@ influxdb-ruby
|
|
5
5
|
|
6
6
|
The official ruby client library for [InfluxDB](https://influxdb.com/).
|
7
7
|
|
8
|
+
> **Support for InfluxDB v0.8.x is now deprecated**. The final version of this library that will support the older InfluxDB interface is `v0.1.9`, which is available as a gem and tagged on this repository. If you're reading this message, then you should only expect support for InfluxDB v0.9.1 and higher.
|
9
|
+
|
8
10
|
Install
|
9
11
|
-------
|
10
12
|
|
data/influxdb.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0.0"
|
27
|
-
spec.add_development_dependency "webmock"
|
27
|
+
spec.add_development_dependency "webmock", "~> 1.21.0"
|
28
28
|
end
|
data/lib/influxdb/point_value.rb
CHANGED
@@ -35,11 +35,12 @@ module InfluxDB
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def escape_value(value, quote_escape)
|
38
|
-
value.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
val = value.
|
39
|
+
gsub(/\s/, '\ ').
|
40
|
+
gsub(',', '\,').
|
41
|
+
gsub('"', '\"')
|
42
|
+
val = %("#{val}") if quote_escape
|
43
|
+
val
|
43
44
|
end
|
44
45
|
|
45
46
|
def escape_key(key)
|
data/lib/influxdb/version.rb
CHANGED
@@ -3,7 +3,7 @@ require "timeout"
|
|
3
3
|
|
4
4
|
describe InfluxDB::Client do
|
5
5
|
let(:subject) { described_class.new(async: true) }
|
6
|
-
|
6
|
+
let(:stub_url) { "http://localhost:8086/write?db=&p=root&precision=s&u=root" }
|
7
7
|
let(:worker_klass) { InfluxDB::Writer::Async::Worker }
|
8
8
|
|
9
9
|
specify { expect(subject.writer).to be_a(InfluxDB::Writer::Async) }
|
@@ -12,9 +12,7 @@ describe InfluxDB::Client do
|
|
12
12
|
let(:payload) { "responses,region=eu value=5" }
|
13
13
|
|
14
14
|
it "sends writes to client" do
|
15
|
-
|
16
|
-
# but cannot be less than 2 due to MAX_POST_POINTS limit
|
17
|
-
expect(subject).to(receive(:write)).at_least(2).times
|
15
|
+
post_request = stub_request(:post, stub_url)
|
18
16
|
|
19
17
|
(worker_klass::MAX_POST_POINTS + 100).times do
|
20
18
|
subject.write_point('a', {})
|
@@ -28,6 +26,10 @@ describe InfluxDB::Client do
|
|
28
26
|
# flush queue (we cannot test `at_exit`)
|
29
27
|
subject.writer.worker.check_background_queue
|
30
28
|
end
|
29
|
+
|
30
|
+
# exact times can be 2 or 3 (because we have 3 worker threads),
|
31
|
+
# but cannot be less than 2 due to MAX_POST_POINTS limit
|
32
|
+
expect(post_request).to have_been_requested.at_least_times(2)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -6,17 +6,21 @@ describe InfluxDB::Writer::Async::Worker do
|
|
6
6
|
let(:worker) { described_class.new(fake_client, {}) }
|
7
7
|
|
8
8
|
describe "#push" do
|
9
|
-
let(:
|
9
|
+
let(:payload1) { "responses,region=eu value=5" }
|
10
|
+
let(:payload2) { "responses,region=eu value=6" }
|
11
|
+
let(:aggregate) { "#{payload1}\n#{payload2}" }
|
10
12
|
|
11
|
-
it "writes to the client" do
|
13
|
+
it "writes aggregate payload to the client" do
|
12
14
|
queue = Queue.new
|
13
|
-
|
14
|
-
queue.push(
|
15
|
+
allow(fake_client).to receive(:write) do |data, _precision|
|
16
|
+
queue.push(data)
|
15
17
|
end
|
16
|
-
worker.push(
|
18
|
+
worker.push(payload1)
|
19
|
+
worker.push(payload2)
|
17
20
|
|
18
21
|
Timeout.timeout(described_class::SLEEP_INTERVAL) do
|
19
|
-
queue.pop
|
22
|
+
result = queue.pop
|
23
|
+
expect(result).to eq aggregate
|
20
24
|
end
|
21
25
|
end
|
22
26
|
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.2.
|
4
|
+
version: 0.2.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: 2015-07-
|
11
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.21.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.21.0
|
97
97
|
description: This is the official Ruby library for InfluxDB.
|
98
98
|
email:
|
99
99
|
- influxdb@googlegroups.com
|