@platformatic/watt-extra 1.16.0 → 1.17.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/.github/workflows/test.yml +2 -2
- package/lib/errors.js +7 -1
- package/lib/utils.js +1 -10
- package/lib/watt.js +17 -2
- package/package.json +14 -15
- package/plugins/env.js +3 -1
- package/plugins/flamegraphs.js +386 -59
- package/plugins/update.js +15 -0
- package/test/profiling-toggle.test.js +746 -0
- package/test/scheduler-coordination.test.js +7 -2
- package/test/scheduler.test.js +15 -11
package/lib/errors.js
CHANGED
|
@@ -19,6 +19,10 @@ const MetadataRuntimeNotStartedError = createError('PLT_METADATA_RUNTIME_NOT_STA
|
|
|
19
19
|
const StatusSendError = createError('PLT_STATUS_SEND_ERROR', 'Failed to send application status')
|
|
20
20
|
const StatusAppIdError = createError('PLT_STATUS_APPID_ERROR', 'Cannot send application status: no applicationId available')
|
|
21
21
|
|
|
22
|
+
// Profiling errors
|
|
23
|
+
const ProfilingRuntimeNotAvailableError = createError('PLT_PROFILING_RUNTIME_NOT_AVAILABLE_ERROR', 'Runtime not available, cannot toggle profiling')
|
|
24
|
+
const ProfilingStatesSendError = createError('PLT_PROFILING_STATES_SEND_ERROR', 'Failed to send profiling states: %s')
|
|
25
|
+
|
|
22
26
|
export {
|
|
23
27
|
CompliancyMetadataError,
|
|
24
28
|
CompliancyStatusError,
|
|
@@ -30,5 +34,7 @@ export {
|
|
|
30
34
|
MetadataAppIdError,
|
|
31
35
|
MetadataRuntimeNotStartedError,
|
|
32
36
|
StatusSendError,
|
|
33
|
-
StatusAppIdError
|
|
37
|
+
StatusAppIdError,
|
|
38
|
+
ProfilingRuntimeNotAvailableError,
|
|
39
|
+
ProfilingStatesSendError
|
|
34
40
|
}
|
package/lib/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { access, rm, readdir } from 'node:fs/promises'
|
|
2
|
-
import { execa } from 'execa'
|
|
3
2
|
|
|
4
3
|
async function fileExists (path) {
|
|
5
4
|
try {
|
|
@@ -23,12 +22,4 @@ async function dirExists (dir) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
const child = execa('tar', ['-xf', tarballPath, '-C', dir])
|
|
28
|
-
child.stdout.pipe(process.stdout)
|
|
29
|
-
child.stderr.pipe(process.stderr)
|
|
30
|
-
|
|
31
|
-
await child
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { fileExists, dirExists, extractTarball }
|
|
25
|
+
export { fileExists, dirExists }
|
package/lib/watt.js
CHANGED
|
@@ -245,11 +245,26 @@ class Watt {
|
|
|
245
245
|
]
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
// Always load the pprof capture preload: PLT_DISABLE_FLAMEGRAPHS only
|
|
249
|
+
// controls whether profiling starts at boot, and ICC can activate it at
|
|
250
|
+
// runtime on this pod with the start-profiling command. The preload is
|
|
251
|
+
// passive until startProfiling is invoked.
|
|
252
|
+
// The module is resolved from watt-extra's own dependencies. If it is
|
|
253
|
+
// missing anyway (e.g. a stripped install), the pod boots without it:
|
|
254
|
+
// profiling is unavailable and the workers are reported as unsupported.
|
|
255
|
+
let pprofPath = null
|
|
256
|
+
try {
|
|
257
|
+
pprofPath = require.resolve('@platformatic/wattpm-pprof-capture')
|
|
258
|
+
} catch {
|
|
259
|
+
this.#logger.warn(
|
|
260
|
+
'@platformatic/wattpm-pprof-capture is not available, profiling is disabled on this pod'
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (pprofPath !== null) {
|
|
249
265
|
if (config.preload === undefined) {
|
|
250
266
|
config.preload = []
|
|
251
267
|
}
|
|
252
|
-
const pprofPath = require.resolve('@platformatic/wattpm-pprof-capture')
|
|
253
268
|
config.preload.push(pprofPath)
|
|
254
269
|
}
|
|
255
270
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/watt-extra",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "The Platformatic runtime manager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -19,38 +19,37 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@fastify/websocket": "^11.1.0",
|
|
22
|
-
"@platformatic/composer": "^3.
|
|
23
|
-
"@platformatic/next": "^3.
|
|
24
|
-
"@platformatic/node": "^3.
|
|
25
|
-
"@platformatic/service": "^3.
|
|
22
|
+
"@platformatic/composer": "^3.68.0",
|
|
23
|
+
"@platformatic/next": "^3.68.0",
|
|
24
|
+
"@platformatic/node": "^3.68.0",
|
|
25
|
+
"@platformatic/service": "^3.68.0",
|
|
26
26
|
"atomic-sleep": "^1.0.0",
|
|
27
27
|
"borp": "^1.0.0",
|
|
28
|
-
"eslint": "
|
|
28
|
+
"eslint": "10",
|
|
29
29
|
"fastify": "^5.10.0",
|
|
30
|
-
"fastify-plugin": "^
|
|
31
|
-
"neostandard": "
|
|
30
|
+
"fastify-plugin": "^6.0.0",
|
|
31
|
+
"neostandard": "0.14.0-next.1",
|
|
32
32
|
"next": "^16.2.10",
|
|
33
|
-
"platformatic": "^3.
|
|
33
|
+
"platformatic": "^3.68.0",
|
|
34
34
|
"pprof-format": "^2.1.0",
|
|
35
35
|
"why-is-node-running": "^2.3.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@datadog/pprof": "^5.9.0",
|
|
39
39
|
"@fastify/error": "^4.2.0",
|
|
40
|
-
"@platformatic/foundation": "^3.
|
|
41
|
-
"@platformatic/runtime": "^3.
|
|
42
|
-
"@platformatic/wattpm-pprof-capture": "^3.
|
|
40
|
+
"@platformatic/foundation": "^3.68.0",
|
|
41
|
+
"@platformatic/runtime": "^3.68.0",
|
|
42
|
+
"@platformatic/wattpm-pprof-capture": "^3.68.0",
|
|
43
43
|
"avvio": "^9.1.0",
|
|
44
44
|
"chalk": "^4.1.2",
|
|
45
45
|
"commist": "^3.2.0",
|
|
46
|
-
"env-schema": "^
|
|
47
|
-
"execa": "^9.6.0",
|
|
46
|
+
"env-schema": "^8.0.0",
|
|
48
47
|
"help-me": "^5.0.0",
|
|
49
48
|
"minimist": "^1.2.8",
|
|
50
49
|
"pino": "^10.0.0",
|
|
51
50
|
"pino-pretty": "^13.0.0",
|
|
52
51
|
"semver": "^7.7.3",
|
|
53
|
-
"undici": "^
|
|
52
|
+
"undici": "^8.0.0",
|
|
54
53
|
"undici-cache-redis": "^1.0.0",
|
|
55
54
|
"undici-slicer-interceptor": "^0.4.1",
|
|
56
55
|
"undici-traffic-interceptor": "^0.1.4",
|
package/plugins/env.js
CHANGED
|
@@ -17,12 +17,14 @@ const schema = {
|
|
|
17
17
|
PLT_APP_INTERNAL_SUB_DOMAIN: { type: 'string', default: 'plt.local' },
|
|
18
18
|
PLT_DEFAULT_CACHE_TAGS_HEADER: { type: 'string', default: 'x-plt-cache-tags' },
|
|
19
19
|
PLT_CACHE_CONFIG: { type: 'string' },
|
|
20
|
-
PLT_DISABLE_FLAMEGRAPHS: { type: 'boolean', default:
|
|
20
|
+
PLT_DISABLE_FLAMEGRAPHS: { type: 'boolean', default: true },
|
|
21
21
|
PLT_FLAMEGRAPHS_INTERVAL_SEC: { type: 'number', default: 60 },
|
|
22
22
|
PLT_FLAMEGRAPHS_ELU_THRESHOLD: { type: 'number', default: 0.4 },
|
|
23
23
|
PLT_FLAMEGRAPHS_GRACE_PERIOD: { type: 'number', default: 3000 },
|
|
24
24
|
PLT_FLAMEGRAPHS_ATTEMPT_TIMEOUT: { type: 'number', default: 10000 },
|
|
25
25
|
PLT_FLAMEGRAPHS_CACHE_CLEANUP_INTERVAL: { type: 'number', default: 120000 },
|
|
26
|
+
PLT_FLAMEGRAPHS_STATE_REPORT_INTERVAL: { type: 'number', default: 30000 },
|
|
27
|
+
PLT_FLAMEGRAPHS_STATE_QUERY_TIMEOUT: { type: 'number', default: 5000 },
|
|
26
28
|
PLT_JWT_EXPIRATION_OFFSET_SEC: { type: 'number', default: 60 },
|
|
27
29
|
PLT_UPDATES_RECONNECT_INTERVAL_SEC: { type: 'number', default: 1 },
|
|
28
30
|
PLT_ELU_HEALTH_SIGNAL_THRESHOLD: { type: 'number', default: 0.7 },
|