influxdb-client 2.10.0.pre.7445 → 3.0.0.pre.7554
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/influxdb2/client/point.rb +13 -11
- data/lib/influxdb2/client/version.rb +1 -1
- data/test/influxdb/point_test.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4b2dc7e810dddec2388e1f1241287aab923d6605209fed449614c1bda7318af
|
4
|
+
data.tar.gz: d9c941fa890969401a179d439607a1b7434ed128ed6ce5916abb395944e674d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a043003e7a44b38dbf5cc6524ad82069b05e9b25b84ae86ec1b37ce7eb1ee6411798345206e4a8d3821ca5111288111b99557b7a4e94a49dc97cbe870d3c6f16
|
7
|
+
data.tar.gz: 81193329f1814dc989b05f6f0f5be3808b11d881b9c64ca73e540237df4f0947cdb9001722d3687352fb41d60d7c55d68e64cde581e92bfa05caa232ea9640ce
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
##
|
1
|
+
## 3.0.0 [unreleased]
|
2
|
+
|
3
|
+
### Bug Fixes
|
4
|
+
1. [#131](https://github.com/influxdata/influxdb-client-ruby/pull/131): Convert time objects present in fields to integer. Prior to this change the timestamps were converted to strings
|
2
5
|
|
3
6
|
## 2.9.0 [2022-12-01]
|
4
7
|
|
@@ -127,7 +127,7 @@ module InfluxDB2
|
|
127
127
|
return nil if fields.empty?
|
128
128
|
|
129
129
|
line_protocol << " #{fields}" if fields
|
130
|
-
timestamp = _escape_time
|
130
|
+
timestamp = _escape_time(@time)
|
131
131
|
line_protocol << " #{timestamp}" if timestamp
|
132
132
|
|
133
133
|
line_protocol
|
@@ -185,6 +185,8 @@ module InfluxDB2
|
|
185
185
|
'"'.freeze + result + '"'.freeze
|
186
186
|
elsif value.is_a?(Integer)
|
187
187
|
"#{value}i"
|
188
|
+
elsif value.is_a?(Time)
|
189
|
+
"#{_escape_time(value)}i"
|
188
190
|
elsif [Float::INFINITY, -Float::INFINITY].include?(value)
|
189
191
|
''
|
190
192
|
else
|
@@ -192,16 +194,16 @@ module InfluxDB2
|
|
192
194
|
end
|
193
195
|
end
|
194
196
|
|
195
|
-
def _escape_time
|
196
|
-
if
|
197
|
+
def _escape_time(value)
|
198
|
+
if value.nil?
|
197
199
|
nil
|
198
|
-
elsif
|
199
|
-
|
200
|
-
elsif
|
201
|
-
|
202
|
-
elsif
|
203
|
-
nano_seconds =
|
204
|
-
nano_seconds +=
|
200
|
+
elsif value.is_a?(Integer)
|
201
|
+
value.to_s
|
202
|
+
elsif value.is_a?(Float)
|
203
|
+
value.round.to_s
|
204
|
+
elsif value.is_a?(Time)
|
205
|
+
nano_seconds = value.to_i * 1e9
|
206
|
+
nano_seconds += value.tv_nsec
|
205
207
|
case @precision || DEFAULT_WRITE_PRECISION
|
206
208
|
when InfluxDB2::WritePrecision::MILLISECOND then
|
207
209
|
(nano_seconds / 1e6).round
|
@@ -213,7 +215,7 @@ module InfluxDB2
|
|
213
215
|
nano_seconds.round
|
214
216
|
end
|
215
217
|
else
|
216
|
-
|
218
|
+
value.to_s
|
217
219
|
end
|
218
220
|
end
|
219
221
|
end
|
data/test/influxdb/point_test.rb
CHANGED
@@ -64,6 +64,7 @@ class PointTest < MiniTest::Test
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def test_field_types
|
67
|
+
time = Time.utc(2023, 11, 1)
|
67
68
|
point = InfluxDB2::Point.new(name: 'h2o')
|
68
69
|
.add_tag('tag_b', 'b')
|
69
70
|
.add_tag('tag_a', 'a')
|
@@ -73,8 +74,10 @@ class PointTest < MiniTest::Test
|
|
73
74
|
.add_field('n4', 5.5)
|
74
75
|
.add_field('bool', true)
|
75
76
|
.add_field('string', 'string value')
|
77
|
+
.add_field('started', time)
|
76
78
|
|
77
|
-
expected = 'h2o,tag_a=a,tag_b=b bool=true,n1=-2i,n2=10i,n3=1265437718438866624512i,n4=5.5,
|
79
|
+
expected = 'h2o,tag_a=a,tag_b=b bool=true,n1=-2i,n2=10i,n3=1265437718438866624512i,n4=5.5,'\
|
80
|
+
'started=1698796800000000000i,string="string value"'
|
78
81
|
assert_equal expected, point.to_line_protocol
|
79
82
|
end
|
80
83
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.pre.7554
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Bednar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|