@platformatic/watt-extra 1.7.1-alpha.4 → 1.7.1-alpha.5
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/package.json +1 -1
- package/plugins/flamegraphs.js +14 -9
package/package.json
CHANGED
package/plugins/flamegraphs.js
CHANGED
|
@@ -235,6 +235,8 @@ async function flamegraphs (app, _opts) {
|
|
|
235
235
|
const sourceMaps = appDetails.sourceMaps ?? false
|
|
236
236
|
profilersConfigs[application.id] = { durationMillis, sourceMaps }
|
|
237
237
|
}
|
|
238
|
+
|
|
239
|
+
setInterval(sendProfilerStates, 10000).unref()
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
app.requestFlamegraphs = async (options = {}) => {
|
|
@@ -351,8 +353,15 @@ async function flamegraphs (app, _opts) {
|
|
|
351
353
|
return { isPaused, pauseEndTimestamp, remainingTimeSec }
|
|
352
354
|
}
|
|
353
355
|
|
|
356
|
+
function sendProfilerStates () {
|
|
357
|
+
const states = getProfilersStates()
|
|
358
|
+
if (states.length > 0) {
|
|
359
|
+
process._rawDebug('--------PROFILER STATES-------', states)
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
354
363
|
function getProfilersStates () {
|
|
355
|
-
const states =
|
|
364
|
+
const states = []
|
|
356
365
|
|
|
357
366
|
for (const serviceId in profilers) {
|
|
358
367
|
const serviceProfilers = profilers[serviceId]
|
|
@@ -366,26 +375,22 @@ async function flamegraphs (app, _opts) {
|
|
|
366
375
|
|
|
367
376
|
if (!isProfiling && !isPaused) continue
|
|
368
377
|
|
|
369
|
-
states
|
|
370
|
-
|
|
378
|
+
states.push({
|
|
379
|
+
serviceId,
|
|
380
|
+
profileType,
|
|
371
381
|
isProfiling,
|
|
372
382
|
isPaused,
|
|
373
383
|
pauseEndTimestamp,
|
|
374
384
|
nextProfileTimestamp,
|
|
375
385
|
nextProfileInSec: nextProfileTimestamp ? Math.round((nextProfileTimestamp - Date.now()) / 1000) : null,
|
|
376
386
|
pauseEndInSec: pauseEndTimestamp ? Math.round((pauseEndTimestamp - Date.now()) / 1000) : null
|
|
377
|
-
}
|
|
387
|
+
})
|
|
378
388
|
}
|
|
379
389
|
}
|
|
380
390
|
|
|
381
391
|
return states
|
|
382
392
|
}
|
|
383
393
|
|
|
384
|
-
setInterval(() => {
|
|
385
|
-
const states = getProfilersStates()
|
|
386
|
-
process._rawDebug('--------PROFILER STATES-------', states)
|
|
387
|
-
}, 1000).unref()
|
|
388
|
-
|
|
389
394
|
function createProfileHandler (scalerUrl, workerId, profileType) {
|
|
390
395
|
const serviceId = workerId.split(':')[0]
|
|
391
396
|
|