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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd312f5542686ccddcc5913b25f6cd55b6c892ac
4
- data.tar.gz: 63bbe7b5008a916da5bd411b5c4a0f0a0f8705a8
3
+ metadata.gz: 48b3b597ccffb495aafb01038b0a00300a5aaf85
4
+ data.tar.gz: ae802e95ce9675869e5ae482d30d6a46ed7318ac
5
5
  SHA512:
6
- metadata.gz: 2d4c579c9af119065cb5d1d30f1d5caf6c3b1b368864d537231ec63ef0a092d543141af4daf8a2860cbb22ad0a6e326aa647aef19b43db79932502c3091c34d3
7
- data.tar.gz: 1857f6d61f6475e0330acc86e2baa5502cb9c2b59f7f18c9d414d375da0c3dc5e332d7fc7b4a662f1ea983599770cefde6fb1fed3021ad763df998e40e7a69a3
6
+ metadata.gz: 9725f16e1b6cf6b15dfab0b0717a30fff9a1eca6dc7b1b7463adf5a985745ff83c14e90191aa58a06167b6be7bc3e085a79424ce303d78172ef8e7f513816f43
7
+ data.tar.gz: 6875eff543b72a4791fd8d7e73b0ceef5a079983dfee1356d758ad43a900d88f77f86bbdb3a0d9d789eeceaab576203a015e83e5ae09ad5ebda2ece3fb2fcfc3
data/Gemfile CHANGED
@@ -2,8 +2,6 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "webmock", git: "https://github.com/influxdb/webmock.git"
6
-
7
5
  local_gemfile = 'Gemfile.local'
8
6
 
9
7
  if File.exist?(local_gemfile)
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
 
@@ -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
@@ -35,11 +35,12 @@ module InfluxDB
35
35
  end
36
36
 
37
37
  def escape_value(value, quote_escape)
38
- value.gsub!(/\s/, '\ ')
39
- value.gsub!(',', '\,')
40
- value.gsub!('"', '\"')
41
- value = %("#{value}") if quote_escape
42
- value
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)
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -101,7 +101,7 @@ module InfluxDB
101
101
 
102
102
  begin
103
103
  log :debug, "Found data in the queue! (#{data.length} points)"
104
- client.write(data)
104
+ client.write(data.join("\n"), nil)
105
105
  rescue => e
106
106
  puts "Cannot write data: #{e.inspect}"
107
107
  end
@@ -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
- # exact times can be 2 or 3 (because we have 3 worker threads),
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(:payload) { "responses,region=eu value=5" }
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
- expect(fake_client).to receive(:write).once.with([payload]) do |_data|
14
- queue.push(:received)
15
+ allow(fake_client).to receive(:write) do |data, _precision|
16
+ queue.push(data)
15
17
  end
16
- worker.push(payload)
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.1
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-25 00:00:00.000000000 Z
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: '0'
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: '0'
96
+ version: 1.21.0
97
97
  description: This is the official Ruby library for InfluxDB.
98
98
  email:
99
99
  - influxdb@googlegroups.com