@platformatic/runtime 3.52.0 → 3.52.2
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/lib/runtime.js +11 -19
- package/lib/worker/controller.js +2 -6
- package/package.json +15 -15
- package/schema.json +1 -1
package/lib/runtime.js
CHANGED
|
@@ -73,8 +73,6 @@ import {
|
|
|
73
73
|
|
|
74
74
|
const kWorkerFile = join(import.meta.dirname, 'worker/main.js')
|
|
75
75
|
const kInspectorOptions = Symbol('plt.runtime.worker.inspectorOptions')
|
|
76
|
-
const kHeapCheckCounter = Symbol('plt.runtime.worker.heapCheckCounter')
|
|
77
|
-
const kLastHeapStats = Symbol('plt.runtime.worker.lastHeapStats')
|
|
78
76
|
|
|
79
77
|
const MAX_LISTENERS_COUNT = 100
|
|
80
78
|
|
|
@@ -1518,28 +1516,17 @@ export class Runtime extends EventEmitter {
|
|
|
1518
1516
|
}
|
|
1519
1517
|
|
|
1520
1518
|
async getWorkerHealth (worker, options = {}) {
|
|
1521
|
-
|
|
1522
|
-
|
|
1519
|
+
// Use ITC to get health from the worker. This correctly forwards to child
|
|
1520
|
+
// processes when the service uses startWithCommand (subprocess mode),
|
|
1521
|
+
// instead of reading the coordinator thread's metrics.
|
|
1522
|
+
const { currentELU, heapUsed, heapTotal } = await sendViaITC(worker, 'getHealth')
|
|
1523
1523
|
|
|
1524
|
+
const previousELU = options.previousELU
|
|
1524
1525
|
let elu = currentELU
|
|
1525
1526
|
if (previousELU) {
|
|
1526
|
-
elu =
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
if (!features.node.worker.getHeapStatistics) {
|
|
1530
|
-
return { elu: elu.utilization, currentELU }
|
|
1527
|
+
elu = performance.eventLoopUtilization(currentELU, previousELU)
|
|
1531
1528
|
}
|
|
1532
1529
|
|
|
1533
|
-
// Only check heap statistics every 60 health checks (once per minute)
|
|
1534
|
-
const counter = (worker[kHeapCheckCounter] ?? 0) + 1
|
|
1535
|
-
worker[kHeapCheckCounter] = counter >= 60 ? 0 : counter
|
|
1536
|
-
|
|
1537
|
-
if (counter >= 60 || !worker[kLastHeapStats]) {
|
|
1538
|
-
const { used_heap_size: heapUsed, total_heap_size: heapTotal } = await worker.getHeapStatistics()
|
|
1539
|
-
worker[kLastHeapStats] = { heapUsed, heapTotal }
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
const { heapUsed, heapTotal } = worker[kLastHeapStats]
|
|
1543
1530
|
return { elu: elu.utilization, heapUsed, heapTotal, currentELU }
|
|
1544
1531
|
}
|
|
1545
1532
|
|
|
@@ -1741,6 +1728,11 @@ export class Runtime extends EventEmitter {
|
|
|
1741
1728
|
index,
|
|
1742
1729
|
count: workersCount
|
|
1743
1730
|
},
|
|
1731
|
+
resourceLimits: {
|
|
1732
|
+
maxOldGenerationSizeMb,
|
|
1733
|
+
maxYoungGenerationSizeMb,
|
|
1734
|
+
codeRangeSizeMb
|
|
1735
|
+
},
|
|
1744
1736
|
inspectorOptions,
|
|
1745
1737
|
dirname: this.#root
|
|
1746
1738
|
},
|
package/lib/worker/controller.js
CHANGED
|
@@ -45,7 +45,6 @@ export class Controller extends EventEmitter {
|
|
|
45
45
|
#fileWatcher
|
|
46
46
|
#debouncedRestart
|
|
47
47
|
#context
|
|
48
|
-
#lastELU
|
|
49
48
|
|
|
50
49
|
constructor (runtimeConfig, applicationConfig, workerId, serverConfig, metricsConfig) {
|
|
51
50
|
super()
|
|
@@ -59,7 +58,6 @@ export class Controller extends EventEmitter {
|
|
|
59
58
|
this.#listening = false
|
|
60
59
|
this.capability = null
|
|
61
60
|
this.#fileWatcher = null
|
|
62
|
-
this.#lastELU = performance.eventLoopUtilization()
|
|
63
61
|
|
|
64
62
|
this.#context = {
|
|
65
63
|
controller: this,
|
|
@@ -74,6 +72,7 @@ export class Controller extends EventEmitter {
|
|
|
74
72
|
metricsConfig,
|
|
75
73
|
serverConfig,
|
|
76
74
|
worker: workerData?.worker,
|
|
75
|
+
resourceLimits: workerData?.resourceLimits,
|
|
77
76
|
hasManagementApi: !!runtimeConfig.managementApi,
|
|
78
77
|
fetchApplicationUrl: fetchApplicationUrl.bind(null, applicationConfig)
|
|
79
78
|
}
|
|
@@ -261,13 +260,10 @@ export class Controller extends EventEmitter {
|
|
|
261
260
|
|
|
262
261
|
async getHealth () {
|
|
263
262
|
const currentELU = performance.eventLoopUtilization()
|
|
264
|
-
const elu = performance.eventLoopUtilization(currentELU, this.#lastELU).utilization
|
|
265
|
-
this.#lastELU = currentELU
|
|
266
|
-
|
|
267
263
|
const { heapUsed, heapTotal } = process.memoryUsage()
|
|
268
264
|
|
|
269
265
|
return {
|
|
270
|
-
|
|
266
|
+
currentELU,
|
|
271
267
|
heapUsed,
|
|
272
268
|
heapTotal
|
|
273
269
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "3.52.
|
|
3
|
+
"version": "3.52.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"typescript": "^5.5.4",
|
|
37
37
|
"undici-oidc-interceptor": "^0.5.0",
|
|
38
38
|
"why-is-node-running": "^2.2.2",
|
|
39
|
-
"@platformatic/composer": "3.52.
|
|
40
|
-
"@platformatic/gateway": "3.52.
|
|
41
|
-
"@platformatic/db": "3.52.
|
|
42
|
-
"@platformatic/node": "3.52.
|
|
43
|
-
"@platformatic/service": "3.52.
|
|
44
|
-
"@platformatic/sql-graphql": "3.52.
|
|
45
|
-
"@platformatic/sql-mapper": "3.52.
|
|
46
|
-
"@platformatic/wattpm-pprof-capture": "3.52.
|
|
39
|
+
"@platformatic/composer": "3.52.2",
|
|
40
|
+
"@platformatic/gateway": "3.52.2",
|
|
41
|
+
"@platformatic/db": "3.52.2",
|
|
42
|
+
"@platformatic/node": "3.52.2",
|
|
43
|
+
"@platformatic/service": "3.52.2",
|
|
44
|
+
"@platformatic/sql-graphql": "3.52.2",
|
|
45
|
+
"@platformatic/sql-mapper": "3.52.2",
|
|
46
|
+
"@platformatic/wattpm-pprof-capture": "3.52.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@fastify/accepts": "^5.0.0",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
"undici": "^7.0.0",
|
|
74
74
|
"undici-thread-interceptor": "^1.3.1",
|
|
75
75
|
"ws": "^8.16.0",
|
|
76
|
-
"@platformatic/basic": "3.52.
|
|
77
|
-
"@platformatic/
|
|
78
|
-
"@platformatic/
|
|
79
|
-
"@platformatic/
|
|
80
|
-
"@platformatic/
|
|
81
|
-
"@platformatic/telemetry": "3.52.
|
|
76
|
+
"@platformatic/basic": "3.52.2",
|
|
77
|
+
"@platformatic/generators": "3.52.2",
|
|
78
|
+
"@platformatic/foundation": "3.52.2",
|
|
79
|
+
"@platformatic/metrics": "3.52.2",
|
|
80
|
+
"@platformatic/itc": "3.52.2",
|
|
81
|
+
"@platformatic/telemetry": "3.52.2"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.52.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.52.2.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Runtime Config",
|
|
5
5
|
"type": "object",
|