@quenty/influxdbclient 7.19.2 → 7.19.3-canary.550.afa1b3b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +15 -15
- package/src/Server/Write/InfluxDBWriteBuffer.lua +24 -13
- package/src/Shared/Write/InfluxDBPoint.lua +38 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.19.3-canary.550.afa1b3b.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/influxdbclient@7.19.2...@quenty/influxdbclient@7.19.3-canary.550.afa1b3b.0) (2025-04-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/influxdbclient
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [7.19.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/influxdbclient@7.19.0...@quenty/influxdbclient@7.19.2) (2025-04-07)
|
|
7
15
|
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/influxdbclient",
|
|
3
|
-
"version": "7.19.
|
|
3
|
+
"version": "7.19.3-canary.550.afa1b3b.0",
|
|
4
4
|
"description": "Provides a Roblox Lua InfluxDB client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "
|
|
29
|
-
"@quenty/httppromise": "
|
|
30
|
-
"@quenty/jsonutils": "
|
|
31
|
-
"@quenty/loader": "
|
|
32
|
-
"@quenty/maid": "
|
|
33
|
-
"@quenty/math": "
|
|
34
|
-
"@quenty/promise": "
|
|
35
|
-
"@quenty/rx": "
|
|
36
|
-
"@quenty/servicebag": "
|
|
37
|
-
"@quenty/signal": "
|
|
38
|
-
"@quenty/string": "
|
|
39
|
-
"@quenty/table": "
|
|
40
|
-
"@quenty/valueobject": "
|
|
28
|
+
"@quenty/baseobject": "10.8.3-canary.550.afa1b3b.0",
|
|
29
|
+
"@quenty/httppromise": "10.10.4-canary.550.afa1b3b.0",
|
|
30
|
+
"@quenty/jsonutils": "10.10.4-canary.550.afa1b3b.0",
|
|
31
|
+
"@quenty/loader": "10.8.3-canary.550.afa1b3b.0",
|
|
32
|
+
"@quenty/maid": "3.4.3-canary.550.afa1b3b.0",
|
|
33
|
+
"@quenty/math": "2.7.3",
|
|
34
|
+
"@quenty/promise": "10.10.4-canary.550.afa1b3b.0",
|
|
35
|
+
"@quenty/rx": "13.17.3-canary.550.afa1b3b.0",
|
|
36
|
+
"@quenty/servicebag": "11.11.4-canary.550.afa1b3b.0",
|
|
37
|
+
"@quenty/signal": "7.10.3-canary.550.afa1b3b.0",
|
|
38
|
+
"@quenty/string": "3.3.3",
|
|
39
|
+
"@quenty/table": "3.7.4-canary.550.afa1b3b.0",
|
|
40
|
+
"@quenty/valueobject": "13.17.3-canary.550.afa1b3b.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "afa1b3b99b862698c3ab46009497bd507150867c"
|
|
46
46
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class InfluxDBWriteBuffer
|
|
3
4
|
]=]
|
|
@@ -13,10 +14,23 @@ local InfluxDBWriteBuffer = setmetatable({}, BaseObject)
|
|
|
13
14
|
InfluxDBWriteBuffer.ClassName = "InfluxDBWriteBuffer"
|
|
14
15
|
InfluxDBWriteBuffer.__index = InfluxDBWriteBuffer
|
|
15
16
|
|
|
16
|
-
export type InfluxDBWriteBuffer = typeof(setmetatable(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
export type InfluxDBWriteBuffer = typeof(setmetatable(
|
|
18
|
+
{} :: {
|
|
19
|
+
_bytes: number,
|
|
20
|
+
_length: number,
|
|
21
|
+
_entries: { string },
|
|
22
|
+
_writeOptions: _InfluxDBWriteOptionUtils.InfluxDBWriteOptions,
|
|
23
|
+
_promiseHandleFlush: (entries: { string }) -> Promise.Promise<()>,
|
|
24
|
+
_requestQueueNext: Signal.Signal<()>,
|
|
25
|
+
},
|
|
26
|
+
{} :: typeof({ __index = InfluxDBWriteBuffer })
|
|
27
|
+
)) & BaseObject.BaseObject
|
|
28
|
+
|
|
29
|
+
function InfluxDBWriteBuffer.new(
|
|
30
|
+
writeOptions: _InfluxDBWriteOptionUtils.InfluxDBWriteOptions,
|
|
31
|
+
promiseHandleFlush
|
|
32
|
+
): InfluxDBWriteBuffer
|
|
33
|
+
local self: InfluxDBWriteBuffer = setmetatable(BaseObject.new() :: any, InfluxDBWriteBuffer)
|
|
20
34
|
|
|
21
35
|
self._writeOptions = assert(writeOptions, "Bad writeOptions")
|
|
22
36
|
self._promiseHandleFlush = assert(promiseHandleFlush, "No promiseHandleFlush")
|
|
@@ -30,10 +44,9 @@ function InfluxDBWriteBuffer.new(writeOptions: _InfluxDBWriteOptionUtils.InfluxD
|
|
|
30
44
|
return self
|
|
31
45
|
end
|
|
32
46
|
|
|
33
|
-
function InfluxDBWriteBuffer
|
|
47
|
+
function InfluxDBWriteBuffer.Add(self: InfluxDBWriteBuffer, entry: string)
|
|
34
48
|
assert(type(entry) == "string", "Bad entry")
|
|
35
49
|
|
|
36
|
-
|
|
37
50
|
-- Already overflowing
|
|
38
51
|
if self._bytes + #entry + 1 >= self._writeOptions.maxBatchBytes then
|
|
39
52
|
self:_promiseFlushAll()
|
|
@@ -44,16 +57,14 @@ function InfluxDBWriteBuffer:Add(entry: string)
|
|
|
44
57
|
self._bytes = self._bytes + #entry + 1
|
|
45
58
|
self._length = self._length + 1
|
|
46
59
|
|
|
47
|
-
if self._length >= self._writeOptions.batchSize
|
|
48
|
-
or self._bytes >= self._writeOptions.maxBatchBytes then
|
|
49
|
-
|
|
60
|
+
if self._length >= self._writeOptions.batchSize or self._bytes >= self._writeOptions.maxBatchBytes then
|
|
50
61
|
self:_promiseFlushAll()
|
|
51
62
|
else
|
|
52
63
|
self:_queueNextSend()
|
|
53
64
|
end
|
|
54
65
|
end
|
|
55
66
|
|
|
56
|
-
function InfluxDBWriteBuffer
|
|
67
|
+
function InfluxDBWriteBuffer._queueNextSend(self: InfluxDBWriteBuffer)
|
|
57
68
|
if self._maid._queuedSendTask then
|
|
58
69
|
return
|
|
59
70
|
end
|
|
@@ -67,7 +78,7 @@ function InfluxDBWriteBuffer:_queueNextSend()
|
|
|
67
78
|
end)
|
|
68
79
|
end
|
|
69
80
|
|
|
70
|
-
function InfluxDBWriteBuffer
|
|
81
|
+
function InfluxDBWriteBuffer._reset(self: InfluxDBWriteBuffer)
|
|
71
82
|
local entries = self._entries
|
|
72
83
|
|
|
73
84
|
self._bytes = 0
|
|
@@ -77,7 +88,7 @@ function InfluxDBWriteBuffer:_reset()
|
|
|
77
88
|
return entries
|
|
78
89
|
end
|
|
79
90
|
|
|
80
|
-
function InfluxDBWriteBuffer
|
|
91
|
+
function InfluxDBWriteBuffer._promiseFlushAll(self: InfluxDBWriteBuffer)
|
|
81
92
|
self._maid._queuedSendTask = nil
|
|
82
93
|
|
|
83
94
|
local entries = self:_reset()
|
|
@@ -88,7 +99,7 @@ function InfluxDBWriteBuffer:_promiseFlushAll()
|
|
|
88
99
|
end
|
|
89
100
|
end
|
|
90
101
|
|
|
91
|
-
function InfluxDBWriteBuffer
|
|
102
|
+
function InfluxDBWriteBuffer.PromiseFlush(self: InfluxDBWriteBuffer)
|
|
92
103
|
return self:_promiseFlushAll()
|
|
93
104
|
end
|
|
94
105
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class InfluxDBPoint
|
|
3
4
|
]=]
|
|
@@ -13,10 +14,25 @@ local InfluxDBPoint = {}
|
|
|
13
14
|
InfluxDBPoint.ClassName = "InfluxDBPoint"
|
|
14
15
|
InfluxDBPoint.__index = InfluxDBPoint
|
|
15
16
|
|
|
16
|
-
export type InfluxDBPoint = typeof(setmetatable(
|
|
17
|
+
export type InfluxDBPoint = typeof(setmetatable(
|
|
18
|
+
{} :: {
|
|
19
|
+
_measurementName: string?,
|
|
20
|
+
_timestamp: (DateTime | string | number)?,
|
|
21
|
+
_tags: { [string]: string },
|
|
22
|
+
_fields: { [string]: string },
|
|
23
|
+
},
|
|
24
|
+
{} :: typeof({ __index = InfluxDBPoint })
|
|
25
|
+
))
|
|
26
|
+
|
|
27
|
+
export type InfluxDBPointTableData = {
|
|
28
|
+
measurementName: string?,
|
|
29
|
+
timestamp: (DateTime | string | number)?,
|
|
30
|
+
tags: { [string]: string },
|
|
31
|
+
fields: { [string]: string },
|
|
32
|
+
}
|
|
17
33
|
|
|
18
34
|
function InfluxDBPoint.new(measurementName: string?): InfluxDBPoint
|
|
19
|
-
local self = setmetatable({}, InfluxDBPoint)
|
|
35
|
+
local self: InfluxDBPoint = setmetatable({} :: any, InfluxDBPoint)
|
|
20
36
|
|
|
21
37
|
assert(type(measurementName) == "string" or measurementName == nil, "Bad measurementName")
|
|
22
38
|
|
|
@@ -28,7 +44,7 @@ function InfluxDBPoint.new(measurementName: string?): InfluxDBPoint
|
|
|
28
44
|
return self
|
|
29
45
|
end
|
|
30
46
|
|
|
31
|
-
function InfluxDBPoint.fromTableData(data)
|
|
47
|
+
function InfluxDBPoint.fromTableData(data: InfluxDBPointTableData)
|
|
32
48
|
assert(type(data) == "table", "Bad data")
|
|
33
49
|
assert(type(data.measurementName) == "string" or data.measurementName == nil, "Bad data.measurementName")
|
|
34
50
|
|
|
@@ -65,17 +81,17 @@ function InfluxDBPoint.isInfluxDBPoint(point: any): boolean
|
|
|
65
81
|
return type(point) == "table" and getmetatable(point) == InfluxDBPoint
|
|
66
82
|
end
|
|
67
83
|
|
|
68
|
-
function InfluxDBPoint
|
|
84
|
+
function InfluxDBPoint.SetMeasurementName(self: InfluxDBPoint, name: string)
|
|
69
85
|
assert(type(name) == "string" or name == nil, "Bad name")
|
|
70
86
|
|
|
71
87
|
self._measurementName = name
|
|
72
88
|
end
|
|
73
89
|
|
|
74
|
-
function InfluxDBPoint
|
|
90
|
+
function InfluxDBPoint.GetMeasurementName(self: InfluxDBPoint): string?
|
|
75
91
|
return self._measurementName
|
|
76
92
|
end
|
|
77
93
|
|
|
78
|
-
function InfluxDBPoint
|
|
94
|
+
function InfluxDBPoint.ToTableData(self: InfluxDBPoint): InfluxDBPointTableData
|
|
79
95
|
return {
|
|
80
96
|
measurementName = self._measurementName,
|
|
81
97
|
timestamp = self._timestamp,
|
|
@@ -89,7 +105,7 @@ end
|
|
|
89
105
|
|
|
90
106
|
@param timestamp DateTime | nil
|
|
91
107
|
]=]
|
|
92
|
-
function InfluxDBPoint
|
|
108
|
+
function InfluxDBPoint.SetTimestamp(self: InfluxDBPoint, timestamp: DateTime?)
|
|
93
109
|
assert(typeof(timestamp) == "DateTime" or timestamp == nil, "Bad timestamp")
|
|
94
110
|
|
|
95
111
|
self._timestamp = timestamp
|
|
@@ -101,7 +117,7 @@ end
|
|
|
101
117
|
@param tagKey string
|
|
102
118
|
@param tagValue string
|
|
103
119
|
]=]
|
|
104
|
-
function InfluxDBPoint
|
|
120
|
+
function InfluxDBPoint.AddTag(self: InfluxDBPoint, tagKey: string, tagValue: string)
|
|
105
121
|
assert(type(tagKey) == "string", "Bad tagKey")
|
|
106
122
|
assert(type(tagValue) == "string", "Bad tagValue")
|
|
107
123
|
|
|
@@ -114,7 +130,7 @@ end
|
|
|
114
130
|
@param fieldName string
|
|
115
131
|
@param value number
|
|
116
132
|
]=]
|
|
117
|
-
function InfluxDBPoint
|
|
133
|
+
function InfluxDBPoint.AddIntField(self: InfluxDBPoint, fieldName: string, value: number)
|
|
118
134
|
assert(type(fieldName) == "string", "Bad fieldName")
|
|
119
135
|
assert(type(value) == "number", "Bad value")
|
|
120
136
|
|
|
@@ -135,7 +151,7 @@ end
|
|
|
135
151
|
@param fieldName string
|
|
136
152
|
@param value number
|
|
137
153
|
]=]
|
|
138
|
-
function InfluxDBPoint
|
|
154
|
+
function InfluxDBPoint.AddUintField(self: InfluxDBPoint, fieldName: string, value: number)
|
|
139
155
|
assert(type(fieldName) == "string", "Bad fieldName")
|
|
140
156
|
assert(type(value) == "number", "Bad value")
|
|
141
157
|
|
|
@@ -157,7 +173,7 @@ end
|
|
|
157
173
|
@param fieldName string
|
|
158
174
|
@param value number
|
|
159
175
|
]=]
|
|
160
|
-
function InfluxDBPoint
|
|
176
|
+
function InfluxDBPoint.AddFloatField(self: InfluxDBPoint, fieldName: string, value: number)
|
|
161
177
|
assert(type(fieldName) == "string", "Bad fieldName")
|
|
162
178
|
assert(type(value) == "number", "Bad value")
|
|
163
179
|
|
|
@@ -174,7 +190,7 @@ end
|
|
|
174
190
|
@param fieldName string
|
|
175
191
|
@param value boolean
|
|
176
192
|
]=]
|
|
177
|
-
function InfluxDBPoint
|
|
193
|
+
function InfluxDBPoint.AddBooleanField(self: InfluxDBPoint, fieldName: string, value: boolean)
|
|
178
194
|
assert(type(fieldName) == "string", "Bad fieldName")
|
|
179
195
|
assert(type(value) == "boolean", "Bad value")
|
|
180
196
|
|
|
@@ -187,14 +203,14 @@ end
|
|
|
187
203
|
@param fieldName string
|
|
188
204
|
@param value string
|
|
189
205
|
]=]
|
|
190
|
-
function InfluxDBPoint
|
|
206
|
+
function InfluxDBPoint.AddStringField(self: InfluxDBPoint, fieldName: string, value: string)
|
|
191
207
|
assert(type(fieldName) == "string", "Bad fieldName")
|
|
192
208
|
assert(type(value) == "string", "Bad value")
|
|
193
209
|
|
|
194
210
|
self._fields[fieldName] = InfluxDBEscapeUtils.quoted(value)
|
|
195
211
|
end
|
|
196
212
|
|
|
197
|
-
function InfluxDBPoint
|
|
213
|
+
function InfluxDBPoint.ToLineProtocol(self: InfluxDBPoint, pointSettings)
|
|
198
214
|
if not self._measurementName then
|
|
199
215
|
return nil
|
|
200
216
|
end
|
|
@@ -232,7 +248,7 @@ function InfluxDBPoint:ToLineProtocol(pointSettings)
|
|
|
232
248
|
end
|
|
233
249
|
end
|
|
234
250
|
|
|
235
|
-
local timestamp = self._timestamp
|
|
251
|
+
local timestamp: any? = self._timestamp
|
|
236
252
|
local convertTime = pointSettings:GetConvertTime()
|
|
237
253
|
if convertTime then
|
|
238
254
|
timestamp = convertTime(timestamp)
|
|
@@ -247,10 +263,15 @@ function InfluxDBPoint:ToLineProtocol(pointSettings)
|
|
|
247
263
|
tagsContent = ""
|
|
248
264
|
end
|
|
249
265
|
|
|
250
|
-
return InfluxDBEscapeUtils.measurement(self._measurementName)
|
|
266
|
+
return InfluxDBEscapeUtils.measurement(self._measurementName)
|
|
267
|
+
.. tagsContent
|
|
268
|
+
.. " "
|
|
269
|
+
.. table.concat(fields, ",")
|
|
270
|
+
.. " "
|
|
271
|
+
.. tostring(timestamp)
|
|
251
272
|
end
|
|
252
273
|
|
|
253
|
-
function InfluxDBPoint
|
|
274
|
+
function InfluxDBPoint._convertTimeToMillis(_self: InfluxDBPoint, value: (string | DateTime | number)?): string?
|
|
254
275
|
if value == nil then
|
|
255
276
|
return tostring(DateTime.now().UnixTimestampMillis)
|
|
256
277
|
elseif type(value) == "string" then
|