@platformatic/watt-extra 1.16.0 → 1.17.0-alpha.1
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 +1 -1
- package/lib/errors.js +7 -1
- package/lib/utils.js +1 -10
- package/lib/watt.js +17 -2
- package/package.json +12 -13
- package/plugins/env.js +2 -0
- 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/plugins/update.js
CHANGED
|
@@ -37,6 +37,21 @@ async function updatePlugin (app) {
|
|
|
37
37
|
return
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// Handle profiling activation/deactivation commands from ICC.
|
|
41
|
+
// Fire and forget: the outcome is reported through the profiling
|
|
42
|
+
// states channel, not through a command reply.
|
|
43
|
+
if (command === 'start-profiling' || command === 'stop-profiling') {
|
|
44
|
+
const enabled = command === 'start-profiling'
|
|
45
|
+
const types = message.params?.types
|
|
46
|
+
app.log.info({ command, types }, 'Received profiling toggle command from ICC')
|
|
47
|
+
try {
|
|
48
|
+
await app.setProfilingEnabled(enabled, types ?? undefined)
|
|
49
|
+
} catch (err) {
|
|
50
|
+
app.log.error({ err, command }, 'Failed to toggle profiling')
|
|
51
|
+
}
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
// Handle a centrally coordinated cron job execution: ICC dispatches
|
|
41
56
|
// each tick to exactly one pod of the application, this one.
|
|
42
57
|
if (command === 'run-scheduled-job') {
|