@platformatic/watt-extra 1.4.0-alpha.1 → 1.4.0-alpha.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/watt-extra",
3
- "version": "1.4.0-alpha.1",
3
+ "version": "1.4.0-alpha.3",
4
4
  "description": "The Platformatic runtime manager",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -19,10 +19,18 @@ async function flamegraphs (app, _opts) {
19
19
  await sleep(gracePeriod)
20
20
 
21
21
  try {
22
+ // Start CPU profiling
22
23
  await runtime.sendCommandToApplication(
23
24
  workerFullId,
24
25
  'startProfiling',
25
- { durationMillis, eluThreshold }
26
+ { durationMillis, eluThreshold, type: 'cpu' }
27
+ )
28
+
29
+ // Start HEAP profiling
30
+ await runtime.sendCommandToApplication(
31
+ workerFullId,
32
+ 'startProfiling',
33
+ { durationMillis, eluThreshold, type: 'heap' }
26
34
  )
27
35
  } catch (err) {
28
36
  app.log.error({ err, ...logContext }, 'Failed to start profiling')
@@ -519,9 +519,15 @@ test('should start profiling on new workers that start after initial setup', asy
519
519
 
520
520
  await waitForClientSubscription
521
521
 
522
- equal(startProfilingCalls.length, 2)
522
+ equal(startProfilingCalls.length, 4)
523
523
  equal(startProfilingCalls[0].serviceId, 'service-1:0')
524
- equal(startProfilingCalls[1].serviceId, 'service-2:0')
524
+ equal(startProfilingCalls[0].options.type, 'cpu')
525
+ equal(startProfilingCalls[1].serviceId, 'service-1:0')
526
+ equal(startProfilingCalls[1].options.type, 'heap')
527
+ equal(startProfilingCalls[2].serviceId, 'service-2:0')
528
+ equal(startProfilingCalls[2].options.type, 'cpu')
529
+ equal(startProfilingCalls[3].serviceId, 'service-2:0')
530
+ equal(startProfilingCalls[3].options.type, 'heap')
525
531
 
526
532
  app.watt.runtime.emit('application:worker:started', {
527
533
  application: 'service-1',
@@ -531,10 +537,15 @@ test('should start profiling on new workers that start after initial setup', asy
531
537
 
532
538
  await sleep(10)
533
539
 
534
- equal(startProfilingCalls.length, 3)
535
- equal(startProfilingCalls[2].serviceId, 'service-1:1')
536
- equal(startProfilingCalls[2].options.durationMillis, 1000)
537
- equal(startProfilingCalls[2].options.eluThreshold, 0)
540
+ equal(startProfilingCalls.length, 6)
541
+ equal(startProfilingCalls[4].serviceId, 'service-1:1')
542
+ equal(startProfilingCalls[4].options.durationMillis, 1000)
543
+ equal(startProfilingCalls[4].options.eluThreshold, 0)
544
+ equal(startProfilingCalls[4].options.type, 'cpu')
545
+ equal(startProfilingCalls[5].serviceId, 'service-1:1')
546
+ equal(startProfilingCalls[5].options.durationMillis, 1000)
547
+ equal(startProfilingCalls[5].options.eluThreshold, 0)
548
+ equal(startProfilingCalls[5].options.type, 'heap')
538
549
 
539
550
  if (app.cleanupFlamegraphs) app.cleanupFlamegraphs()
540
551
  await app.closeUpdates()