influxdb-client 2.10.0.pre.7445 → 3.0.0
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/README.md +2 -2
- 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 +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7df039eb876d1f1838a22630b2477fd4f07911b633d52e42012153dca539c0ca
|
4
|
+
data.tar.gz: dd1713ccdd4b0ab34ab71d4b0159a83ef9534c1ed5bed3af2949a11c04a75f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c85780d8b6a499f2d9eb7f312351916bd0bf4b6b02fb64fd1f31ca9e0135068057ef304c02e975f4752d2ddb285b19c95538bcb9e77d25c103d917aa05a154d7
|
7
|
+
data.tar.gz: 54b181dd450e2ba225a916cdb59727423d011c4793eb0cba0d2d95e1c2323a95b0518535e5eb9f39491e6e30fa2d837c21bb20220d3ae213b5f9a1435853d602
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
##
|
1
|
+
## 3.0.0 [2023-12-05]
|
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
|
|
data/README.md
CHANGED
@@ -64,13 +64,13 @@ The client can be installed manually or with bundler.
|
|
64
64
|
To install the client gem manually:
|
65
65
|
|
66
66
|
```
|
67
|
-
gem install influxdb-client -v
|
67
|
+
gem install influxdb-client -v 3.0.0
|
68
68
|
```
|
69
69
|
|
70
70
|
For management API:
|
71
71
|
|
72
72
|
```
|
73
|
-
gem install influxdb-client-apis -v
|
73
|
+
gem install influxdb-client-apis -v 3.0.0
|
74
74
|
```
|
75
75
|
|
76
76
|
## Usage
|
@@ -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
|
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
|
+
date: 2023-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -180,27 +180,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: 2.2.0
|
181
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
|
-
- - "
|
183
|
+
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
185
|
+
version: '0'
|
186
186
|
requirements: []
|
187
|
-
rubygems_version: 3.3.
|
187
|
+
rubygems_version: 3.0.3.1
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: Ruby library for InfluxDB 2.
|
191
191
|
test_files:
|
192
|
-
- test/influxdb/
|
192
|
+
- test/influxdb/query_api_integration_test.rb
|
193
193
|
- test/influxdb/default_api_test.rb
|
194
|
+
- test/influxdb/client_test.rb
|
195
|
+
- test/influxdb/query_api_test.rb
|
194
196
|
- test/influxdb/delete_api_integration_test.rb
|
195
|
-
- test/influxdb/
|
196
|
-
- test/influxdb/flux_csv_parser_test.rb
|
197
|
-
- test/influxdb/invokable_scripts_api_test.rb
|
198
|
-
- test/influxdb/point_test.rb
|
199
|
-
- test/influxdb/query_api_integration_test.rb
|
197
|
+
- test/influxdb/write_api_integration_test.rb
|
200
198
|
- test/influxdb/query_api_stream_test.rb
|
201
|
-
- test/influxdb/
|
199
|
+
- test/influxdb/flux_csv_parser_test.rb
|
200
|
+
- test/influxdb/delete_api_test.rb
|
202
201
|
- test/influxdb/redirect_test.rb
|
203
|
-
- test/influxdb/write_api_batching_test.rb
|
204
|
-
- test/influxdb/write_api_integration_test.rb
|
205
202
|
- test/influxdb/write_api_test.rb
|
203
|
+
- test/influxdb/write_api_batching_test.rb
|
204
|
+
- test/influxdb/point_test.rb
|
205
|
+
- test/influxdb/invokable_scripts_api_test.rb
|
206
206
|
- test/test_helper.rb
|