@quenty/influxdbclient 7.20.0-canary.ae8d76d.0 → 7.20.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 +2 -2
- package/package.json +15 -15
- package/src/Server/Config/InfluxDBClientConfigUtils.lua +3 -3
- package/src/Server/Config/InfluxDBWriteOptionUtils.lua +9 -9
- package/src/Server/InfluxDBClient.lua +1 -1
- package/src/Server/InfluxDBClient.story.lua +6 -5
- package/src/Server/Utils/InfluxDBErrorUtils.lua +2 -4
- package/src/Server/Write/InfluxDBWriteAPI.lua +3 -7
- package/src/Server/Write/InfluxDBWriteBuffer.lua +1 -1
- package/src/Shared/Utils/InfluxDBEscapeUtils.lua +17 -18
- package/src/Shared/Utils/InfluxDBEscapeUtils.spec.lua +5 -4
- package/src/Shared/Write/InfluxDBPoint.lua +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.20.0
|
|
6
|
+
# [7.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/influxdbclient@7.19.3...@quenty/influxdbclient@7.20.0) (2025-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
@@ -13,7 +13,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
13
13
|
|
|
14
14
|
### Features
|
|
15
15
|
|
|
16
|
-
* Add even more types ([
|
|
16
|
+
* Add even more types ([b31717d](https://github.com/Quenty/NevermoreEngine/commit/b31717d8c9f7620c457f5018a2affa760a65334a))
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/influxdbclient",
|
|
3
|
-
"version": "7.20.0
|
|
3
|
+
"version": "7.20.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": "10.
|
|
29
|
-
"@quenty/httppromise": "10.11.0
|
|
30
|
-
"@quenty/jsonutils": "10.11.0
|
|
31
|
-
"@quenty/loader": "10.
|
|
32
|
-
"@quenty/maid": "3.
|
|
33
|
-
"@quenty/math": "2.7.3",
|
|
34
|
-
"@quenty/promise": "10.11.0
|
|
35
|
-
"@quenty/rx": "13.18.0
|
|
36
|
-
"@quenty/servicebag": "11.12.0
|
|
37
|
-
"@quenty/signal": "7.
|
|
38
|
-
"@quenty/string": "3.3.3",
|
|
39
|
-
"@quenty/table": "3.
|
|
40
|
-
"@quenty/valueobject": "13.18.0
|
|
28
|
+
"@quenty/baseobject": "^10.9.0",
|
|
29
|
+
"@quenty/httppromise": "^10.11.0",
|
|
30
|
+
"@quenty/jsonutils": "^10.11.0",
|
|
31
|
+
"@quenty/loader": "^10.9.0",
|
|
32
|
+
"@quenty/maid": "^3.5.0",
|
|
33
|
+
"@quenty/math": "^2.7.3",
|
|
34
|
+
"@quenty/promise": "^10.11.0",
|
|
35
|
+
"@quenty/rx": "^13.18.0",
|
|
36
|
+
"@quenty/servicebag": "^11.12.0",
|
|
37
|
+
"@quenty/signal": "^7.11.0",
|
|
38
|
+
"@quenty/string": "^3.3.3",
|
|
39
|
+
"@quenty/table": "^3.8.0",
|
|
40
|
+
"@quenty/valueobject": "^13.18.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "20cff952c2cf06b959f2f11d2293bdef38acc604"
|
|
46
46
|
}
|
|
@@ -32,9 +32,9 @@ function InfluxDBClientConfigUtils.createClientConfig(config: InfluxDBClientConf
|
|
|
32
32
|
assert(InfluxDBClientConfigUtils.isClientConfig(config), "Bad config")
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
|
-
url = config.url
|
|
36
|
-
token = config.token
|
|
35
|
+
url = config.url,
|
|
36
|
+
token = config.token,
|
|
37
37
|
}
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
return InfluxDBClientConfigUtils
|
|
40
|
+
return InfluxDBClientConfigUtils
|
|
@@ -42,14 +42,14 @@ function InfluxDBWriteOptionUtils.isWriteOptions(options: any): boolean
|
|
|
42
42
|
and type(options.batchSize) == "number"
|
|
43
43
|
and type(options.maxBatchBytes) == "number"
|
|
44
44
|
and type(options.flushIntervalSeconds) == "number"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
-- and type(options.maxRetries) == "number"
|
|
46
|
+
-- and type(options.maxRetryTimeSeconds) == "number"
|
|
47
|
+
-- and type(options.maxBufferLines) == "number"
|
|
48
|
+
-- and type(options.retryJitterSeconds) == "number"
|
|
49
|
+
-- and type(options.minRetryDelaySeconds) == "number"
|
|
50
|
+
-- and type(options.maxRetryDelaySeconds) == "number"
|
|
51
|
+
-- and type(options.exponentialBase) == "number"
|
|
52
|
+
-- and type(options.randomRetry) == "boolean"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
return InfluxDBWriteOptionUtils
|
|
55
|
+
return InfluxDBWriteOptionUtils
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@class InfluxDBClient.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local InfluxDBClient = require("InfluxDBClient")
|
|
8
9
|
local InfluxDBClientConfigUtils = require("InfluxDBClientConfigUtils")
|
|
@@ -13,8 +14,8 @@ return function(_target)
|
|
|
13
14
|
local maid = Maid.new()
|
|
14
15
|
|
|
15
16
|
local config = InfluxDBClientConfigUtils.createClientConfig({
|
|
16
|
-
url = "https://ingest.robloxanalytics.com/"
|
|
17
|
-
token = "test-api-key"
|
|
17
|
+
url = "https://ingest.robloxanalytics.com/",
|
|
18
|
+
token = "test-api-key",
|
|
18
19
|
})
|
|
19
20
|
|
|
20
21
|
local influxDBClient = InfluxDBClient.new(config)
|
|
@@ -33,7 +34,7 @@ return function(_target)
|
|
|
33
34
|
point:AddTag("place_id", tostring(game.PlaceId))
|
|
34
35
|
point:AddStringField("username", "Quenty")
|
|
35
36
|
point:AddIntField("userid", 4397833)
|
|
36
|
-
point:AddFloatField("fps", 30 + math.random()*30)
|
|
37
|
+
point:AddFloatField("fps", 30 + math.random() * 30)
|
|
37
38
|
point:AddBooleanField("is_alive", true)
|
|
38
39
|
point:AddBooleanField("is_silent", false)
|
|
39
40
|
|
|
@@ -48,4 +49,4 @@ return function(_target)
|
|
|
48
49
|
return function()
|
|
49
50
|
maid:DoCleaning()
|
|
50
51
|
end
|
|
51
|
-
end
|
|
52
|
+
end
|
|
@@ -48,9 +48,7 @@ end
|
|
|
48
48
|
@return boolean
|
|
49
49
|
]=]
|
|
50
50
|
function InfluxDBErrorUtils.isInfluxDBError(data: any): boolean
|
|
51
|
-
return type(data) == "table"
|
|
52
|
-
and type(data.code) == "string"
|
|
53
|
-
and type(data.message) == "string"
|
|
51
|
+
return type(data) == "table" and type(data.code) == "string" and type(data.message) == "string"
|
|
54
52
|
end
|
|
55
53
|
|
|
56
|
-
return InfluxDBErrorUtils
|
|
54
|
+
return InfluxDBErrorUtils
|
|
@@ -11,6 +11,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
11
11
|
local BaseObject = require("BaseObject")
|
|
12
12
|
local HttpPromise = require("HttpPromise")
|
|
13
13
|
local InfluxDBClientConfigUtils = require("InfluxDBClientConfigUtils")
|
|
14
|
+
local InfluxDBErrorUtils = require("InfluxDBErrorUtils")
|
|
14
15
|
local InfluxDBPoint = require("InfluxDBPoint")
|
|
15
16
|
local InfluxDBPointSettings = require("InfluxDBPointSettings")
|
|
16
17
|
local InfluxDBWriteBuffer = require("InfluxDBWriteBuffer")
|
|
@@ -18,7 +19,6 @@ local InfluxDBWriteOptionUtils = require("InfluxDBWriteOptionUtils")
|
|
|
18
19
|
local Promise = require("Promise")
|
|
19
20
|
local Signal = require("Signal")
|
|
20
21
|
local ValueObject = require("ValueObject")
|
|
21
|
-
local InfluxDBErrorUtils = require("InfluxDBErrorUtils")
|
|
22
22
|
|
|
23
23
|
local InfluxDBWriteAPI = setmetatable({}, BaseObject)
|
|
24
24
|
InfluxDBWriteAPI.ClassName = "InfluxDBWriteAPI"
|
|
@@ -254,11 +254,7 @@ function InfluxDBWriteAPI._getWriteUrl(self: InfluxDBWriteAPI): string
|
|
|
254
254
|
-- escape trailing slashes
|
|
255
255
|
url = string.match(url, "(.-)[\\/]*$") or ""
|
|
256
256
|
|
|
257
|
-
return string.format("%s/api/v2/write?org=%s&bucket=%s&precision=%s",
|
|
258
|
-
url,
|
|
259
|
-
self._org,
|
|
260
|
-
self._bucket,
|
|
261
|
-
self._precision)
|
|
257
|
+
return string.format("%s/api/v2/write?org=%s&bucket=%s&precision=%s", url, self._org, self._bucket, self._precision)
|
|
262
258
|
end
|
|
263
259
|
|
|
264
|
-
return InfluxDBWriteAPI
|
|
260
|
+
return InfluxDBWriteAPI
|
|
@@ -62,33 +62,32 @@ function InfluxDBEscapeUtils.createQuotedEscaper(subTable: EscapeTable): (string
|
|
|
62
62
|
local escaper = InfluxDBEscapeUtils.createEscaper(subTable)
|
|
63
63
|
|
|
64
64
|
return function(str: string)
|
|
65
|
-
return string.format("
|
|
65
|
+
return string.format('"%s"', escaper(str))
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
|
|
70
69
|
InfluxDBEscapeUtils.measurement = InfluxDBEscapeUtils.createEscaper({
|
|
71
|
-
[","] = "\\,"
|
|
72
|
-
[" "] = "\\ "
|
|
73
|
-
["\n"] = "\\n"
|
|
74
|
-
["\r"] = "\\r"
|
|
75
|
-
["\t"] = "\\t"
|
|
76
|
-
["\\"] = "\\\\"
|
|
70
|
+
[","] = "\\,",
|
|
71
|
+
[" "] = "\\ ",
|
|
72
|
+
["\n"] = "\\n",
|
|
73
|
+
["\r"] = "\\r",
|
|
74
|
+
["\t"] = "\\t",
|
|
75
|
+
["\\"] = "\\\\", -- not sure about this, is this part of spec?
|
|
77
76
|
})
|
|
78
77
|
|
|
79
78
|
InfluxDBEscapeUtils.quoted = InfluxDBEscapeUtils.createQuotedEscaper({
|
|
80
|
-
["
|
|
81
|
-
["\\"] = "\\\\"
|
|
79
|
+
['"'] = '\\"',
|
|
80
|
+
["\\"] = "\\\\",
|
|
82
81
|
})
|
|
83
82
|
|
|
84
83
|
InfluxDBEscapeUtils.tag = InfluxDBEscapeUtils.createEscaper({
|
|
85
|
-
[","] = "\\,"
|
|
86
|
-
[" "] = "\\ "
|
|
87
|
-
["="] = "\\="
|
|
88
|
-
["\n"] = "\\n"
|
|
89
|
-
["\r"] = "\\r"
|
|
90
|
-
["\t"] = "\\t"
|
|
91
|
-
["\\"] = "\\\\"
|
|
84
|
+
[","] = "\\,",
|
|
85
|
+
[" "] = "\\ ",
|
|
86
|
+
["="] = "\\=",
|
|
87
|
+
["\n"] = "\\n",
|
|
88
|
+
["\r"] = "\\r",
|
|
89
|
+
["\t"] = "\\t",
|
|
90
|
+
["\\"] = "\\\\", -- not sure about this, is this part of spec?
|
|
92
91
|
})
|
|
93
92
|
|
|
94
|
-
return InfluxDBEscapeUtils
|
|
93
|
+
return InfluxDBEscapeUtils
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@class InfluxDBEscapeUtils.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local InfluxDBEscapeUtils = require("InfluxDBEscapeUtils")
|
|
8
9
|
local Jest = require("Jest")
|
|
@@ -25,11 +26,11 @@ end)
|
|
|
25
26
|
|
|
26
27
|
describe("InfluxDBEscapeUtils.quoted", function()
|
|
27
28
|
it("should pass through fine", function()
|
|
28
|
-
expect(InfluxDBEscapeUtils.quoted("hi")).toBe("
|
|
29
|
+
expect(InfluxDBEscapeUtils.quoted("hi")).toBe('"hi"')
|
|
29
30
|
end)
|
|
30
31
|
|
|
31
32
|
it("should escape quotes", function()
|
|
32
|
-
expect(InfluxDBEscapeUtils.quoted("
|
|
33
|
+
expect(InfluxDBEscapeUtils.quoted('"hi')).toBe('"\\"hi"')
|
|
33
34
|
end)
|
|
34
35
|
end)
|
|
35
36
|
|
|
@@ -58,4 +59,4 @@ describe("InfluxDBEscapeUtils.tag", function()
|
|
|
58
59
|
local tag = InfluxDBEscapeUtils.tag("\nhi")
|
|
59
60
|
expect(tag).toBe("\\nhi")
|
|
60
61
|
end)
|
|
61
|
-
end)
|
|
62
|
+
end)
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
|
-
local Math = require("Math")
|
|
9
8
|
local InfluxDBEscapeUtils = require("InfluxDBEscapeUtils")
|
|
10
|
-
local Table = require("Table")
|
|
11
|
-
local Set = require("Set")
|
|
12
9
|
local InfluxDBPointSettings = require("InfluxDBPointSettings")
|
|
10
|
+
local Math = require("Math")
|
|
11
|
+
local Set = require("Set")
|
|
12
|
+
local Table = require("Table")
|
|
13
13
|
|
|
14
14
|
local InfluxDBPoint = {}
|
|
15
15
|
InfluxDBPoint.ClassName = "InfluxDBPoint"
|
|
@@ -251,7 +251,10 @@ end
|
|
|
251
251
|
@param pointSettings InfluxDBPointSettings
|
|
252
252
|
@return string?
|
|
253
253
|
]=]
|
|
254
|
-
function InfluxDBPoint.ToLineProtocol(
|
|
254
|
+
function InfluxDBPoint.ToLineProtocol(
|
|
255
|
+
self: InfluxDBPoint,
|
|
256
|
+
pointSettings: InfluxDBPointSettings.InfluxDBPointSettings
|
|
257
|
+
): string?
|
|
255
258
|
if not self._measurementName then
|
|
256
259
|
return nil
|
|
257
260
|
end
|
|
@@ -314,7 +317,7 @@ end
|
|
|
314
317
|
|
|
315
318
|
function InfluxDBPoint._convertTimeToMillis(_self: InfluxDBPoint, value: (string | DateTime | number)?): string?
|
|
316
319
|
if value == nil then
|
|
317
|
-
|
|
320
|
+
return tostring(DateTime.now().UnixTimestampMillis)
|
|
318
321
|
elseif type(value) == "string" then
|
|
319
322
|
if #value > 0 then
|
|
320
323
|
return value
|
|
@@ -330,4 +333,4 @@ function InfluxDBPoint._convertTimeToMillis(_self: InfluxDBPoint, value: (string
|
|
|
330
333
|
end
|
|
331
334
|
end
|
|
332
335
|
|
|
333
|
-
return InfluxDBPoint
|
|
336
|
+
return InfluxDBPoint
|