influxdb 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +5 -1
- data/lib/influxdb/point_value.rb +11 -14
- data/lib/influxdb/version.rb +1 -1
- data/spec/influxdb/cases/udp_client_spec.rb +1 -1
- data/spec/influxdb/point_value_spec.rb +6 -6
- 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: 6c2b06fa209203def8adb7dd52f58f7abec274f7
|
4
|
+
data.tar.gz: 16aa0e2a02215f6738cebcdfd8b4b988778f5187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 075868eb0f2dd7b08cc1baad82a7fd4aa27516a627b035d64e9779270bc23f25625780b93c8a210c4b5c4e5c12cea1848b5a3c9c54e5889b5a674b1b57d5246e
|
7
|
+
data.tar.gz: 25ec27ea28255e5449e18beca91036ecfc4a859ab887a1aca0199ba68376ad6481165c710c8d6465a3e6d34acc0b8b553cb036a086259c8001fa78cebe393f43
|
data/.travis.yml
CHANGED
@@ -7,7 +7,7 @@ rvm:
|
|
7
7
|
- 2.0.0
|
8
8
|
- 2.1.10
|
9
9
|
- 2.2.4
|
10
|
-
- 2.3.
|
10
|
+
- 2.3.1
|
11
11
|
- ruby-head
|
12
12
|
env:
|
13
13
|
- TEST_TASK=spec
|
@@ -17,7 +17,7 @@ matrix:
|
|
17
17
|
- rvm: ruby-head
|
18
18
|
- rvm: jruby-9.0.5.0
|
19
19
|
include:
|
20
|
-
- rvm: 2.3.
|
20
|
+
- rvm: 2.3.1
|
21
21
|
env: TEST_TASK=rubocop
|
22
22
|
- rvm: jruby-9.0.5.0
|
23
23
|
env: JRUBY_OPTS='-J-Xmx256M'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/commits/master).
|
4
4
|
|
5
|
+
## v0.3.1, released 2016-05-26
|
6
|
+
|
7
|
+
- Fixed #130 (again). Integer values are now really written as Integers to InfluxDB.
|
8
|
+
|
5
9
|
## v0.3.0, released 2016-04-24
|
6
10
|
|
7
11
|
- Write queries are now checked against 204 No Content responses, in accordance with the official documentation (#128).
|
@@ -20,7 +24,7 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
|
|
20
24
|
|
21
25
|
- Added `InfluxDB::Client#version`, returning the server version (#117).
|
22
26
|
- Fixed escaping issues (#119, #121, #135).
|
23
|
-
-
|
27
|
+
- Integer values are now written as Integer, not as Float value (#131).
|
24
28
|
- Return all result series when querying multiple selects (#134).
|
25
29
|
- Made host cycling thread safe (#136).
|
26
30
|
|
data/lib/influxdb/point_value.rb
CHANGED
@@ -36,28 +36,25 @@ module InfluxDB
|
|
36
36
|
s
|
37
37
|
end
|
38
38
|
|
39
|
-
def map(data, quote_escape)
|
40
|
-
data.map do |k, v|
|
41
|
-
key = escape_key(k)
|
42
|
-
val = v.is_a?(String) ? escape_value(v, quote_escape) : v
|
43
|
-
val = val.is_a?(Integer) ? "#{val}i" : v
|
44
|
-
"#{key}=#{val}"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
39
|
def escape_values(values)
|
49
40
|
return if values.nil?
|
50
41
|
values.map do |k, v|
|
51
42
|
key = escape(k.to_s, :field_key)
|
52
|
-
val =
|
53
|
-
'"' + escape(v, :field_value) + '"'
|
54
|
-
else
|
55
|
-
v.to_s
|
56
|
-
end
|
43
|
+
val = escape_value(v)
|
57
44
|
"#{key}=#{val}"
|
58
45
|
end.join(",")
|
59
46
|
end
|
60
47
|
|
48
|
+
def escape_value(value)
|
49
|
+
if value.is_a?(String)
|
50
|
+
'"' + escape(value, :field_value) + '"'
|
51
|
+
elsif value.is_a?(Integer)
|
52
|
+
"#{value}i"
|
53
|
+
else
|
54
|
+
value.to_s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
61
58
|
def escape_tags(tags)
|
62
59
|
return if tags.nil?
|
63
60
|
|
data/lib/influxdb/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe InfluxDB::Client do
|
|
6
6
|
specify { expect(client.writer).to be_a(InfluxDB::Writer::UDP) }
|
7
7
|
|
8
8
|
describe "#write" do
|
9
|
-
let(:message) { 'responses,region=eu value=
|
9
|
+
let(:message) { 'responses,region=eu value=5i' }
|
10
10
|
|
11
11
|
it "sends a UPD packet" do
|
12
12
|
s = UDPSocket.new
|
@@ -6,14 +6,14 @@ describe InfluxDB::PointValue do
|
|
6
6
|
{
|
7
7
|
series: '1= ,"\\1',
|
8
8
|
tags: { '2= ,"\\2' => '3= ,"\\3' },
|
9
|
-
values: { '4= ,"\\4' => '5= ,"\\5' }
|
9
|
+
values: { '4= ,"\\4' => '5= ,"\\5', intval: 5, floatval: 7.0 }
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should escape correctly' do
|
14
14
|
point = InfluxDB::PointValue.new(data)
|
15
15
|
expected = %(1=\\ \\,"\\1,2\\=\\ \\,"\\2=3\\=\\ \\,"\\3 ) +
|
16
|
-
%(4\\=\\ \\,\\"\\4="5= ,\\"\\5")
|
16
|
+
%(4\\=\\ \\,\\"\\4="5= ,\\"\\5",intval=5i,floatval=7.0)
|
17
17
|
expect(point.dump).to eq(expected)
|
18
18
|
end
|
19
19
|
end
|
@@ -21,7 +21,7 @@ describe InfluxDB::PointValue do
|
|
21
21
|
describe 'dump' do
|
22
22
|
context "with all possible data passed" do
|
23
23
|
let(:expected_value) do
|
24
|
-
'responses,region=eu,status=200 value=
|
24
|
+
'responses,region=eu,status=200 value=5i,threshold=0.54 1436349652'
|
25
25
|
end
|
26
26
|
it 'should have proper form' do
|
27
27
|
point = InfluxDB::PointValue.new(series: "responses",
|
@@ -35,7 +35,7 @@ describe InfluxDB::PointValue do
|
|
35
35
|
|
36
36
|
context "with no tags" do
|
37
37
|
let(:expected_value) do
|
38
|
-
"responses value=
|
38
|
+
"responses value=5i,threshold=0.54 1436349652"
|
39
39
|
end
|
40
40
|
it 'should have proper form' do
|
41
41
|
point = InfluxDB::PointValue.new(series: "responses",
|
@@ -48,7 +48,7 @@ describe InfluxDB::PointValue do
|
|
48
48
|
|
49
49
|
context "with values only" do
|
50
50
|
let(:expected_value) do
|
51
|
-
"responses value=
|
51
|
+
"responses value=5i,threshold=0.54"
|
52
52
|
end
|
53
53
|
it 'should have proper form' do
|
54
54
|
point = InfluxDB::PointValue.new(series: "responses",
|
@@ -60,7 +60,7 @@ describe InfluxDB::PointValue do
|
|
60
60
|
|
61
61
|
context "empty tag values" do
|
62
62
|
let(:expected_value) do
|
63
|
-
"responses,region=eu value=
|
63
|
+
"responses,region=eu value=5i"
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should be omitted" do
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|