persistence-providers 0.0.3.2 → 0.0.3.3
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e42a6523c2d6174ede530cc548395abb6a312aa02cda2339911e826e3b7c74
|
4
|
+
data.tar.gz: d7fe828c7edea2f815a02fb0266f954147b78c821e20e2faafe6dfda746f368f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3da2506d197ca4da363862b8a3b37ecfc7a96d8196f6c4748d84b40a64ffaf5edcdf2475e318ad18a31185b1700d76a8a5ded2a92d8f20324fb78b0d1f02b3f2
|
7
|
+
data.tar.gz: 40663bb7fbb15f8fe50a25dd9f6f2da9108f478e94b3a57409f0e9856190a7fdac53d561eebde6e8cf3e25b3579e242a8782f31f93b8a6ea597fd69faf82ecd3
|
@@ -14,21 +14,13 @@ module DTK::State
|
|
14
14
|
query_api.query(query_expression)
|
15
15
|
end
|
16
16
|
|
17
|
-
def return_line_protocol_data(data)
|
18
|
-
protocol_string = ''
|
19
|
-
protocol_string += data[:name].to_s + ','
|
20
|
-
data[:tags].each_pair { |key,value| protocol_string+="#{key}=#{value},"}
|
21
|
-
protocol_string.delete_suffix!(',')
|
22
|
-
protocol_string += ' '
|
23
|
-
data[:fields].each_pair { |key,value| protocol_string+="#{key}=\"#{value.gsub!(/"/, '\"')},\"" }
|
24
|
-
protocol_string.delete_suffix!(',')
|
25
|
-
protocol_string += " #{data[:time].to_s}"
|
26
|
-
end
|
27
|
-
|
28
17
|
def write_point(data)
|
29
|
-
|
30
|
-
|
31
|
-
|
18
|
+
begin
|
19
|
+
write_api = self.connection.create_write_api
|
20
|
+
write_api.write(data: data)
|
21
|
+
rescue => error
|
22
|
+
fail error
|
23
|
+
end
|
32
24
|
end
|
33
25
|
|
34
26
|
def measurement_helper(measurement_name)
|
@@ -45,8 +45,8 @@ module DTK::State
|
|
45
45
|
influxdb_encoding = influxdb_encoding(params_hash, timestamp)
|
46
46
|
timestamp = timestamp.nil? ? Time.now : timestamp
|
47
47
|
data = {
|
48
|
-
name: name,
|
49
|
-
tags: influxdb_encoding.tags,
|
48
|
+
name: name.to_s,
|
49
|
+
tags: get_string_params(influxdb_encoding.tags),
|
50
50
|
fields: { value: value },
|
51
51
|
time: (timestamp.to_f * 1000).to_i
|
52
52
|
}
|
@@ -74,6 +74,14 @@ module DTK::State
|
|
74
74
|
def influxdb_encoding(params_hash, timestamp)
|
75
75
|
InfluxdbEncoding.new(self.name, params_hash, timestamp)
|
76
76
|
end
|
77
|
+
|
78
|
+
def get_string_params(array)
|
79
|
+
string_array = {}
|
80
|
+
array.each_pair do |key, value|
|
81
|
+
string_array[key.to_s] = value
|
82
|
+
end
|
83
|
+
string_array
|
84
|
+
end
|
77
85
|
|
78
86
|
LEGAL_TAG_CLASSES = [::String, ::Symbol, ::Integer]
|
79
87
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistence-providers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3.
|
4
|
+
version: 0.0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kubeclient
|