@nxtedition/lib 19.10.5 → 19.11.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/app.js +25 -22
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -438,7 +438,24 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
438
438
|
timestamp: Date.now(),
|
|
439
439
|
})),
|
|
440
440
|
rx.auditTime(1e3),
|
|
441
|
-
rx.
|
|
441
|
+
rx.withLatestFrom(
|
|
442
|
+
rxjs.timer(0, 1e3).pipe(
|
|
443
|
+
rx.map(() => performance.eventLoopUtilization?.()),
|
|
444
|
+
rx.pairwise(),
|
|
445
|
+
rx.map(([elu1, elu2]) => ({
|
|
446
|
+
ds: ds?.stats,
|
|
447
|
+
couch: couch?.stats,
|
|
448
|
+
lag: toobusy?.lag(),
|
|
449
|
+
memory: process.memoryUsage(),
|
|
450
|
+
utilization: performance.eventLoopUtilization?.(elu2, elu1),
|
|
451
|
+
heap: v8.getHeapStatistics(),
|
|
452
|
+
})),
|
|
453
|
+
),
|
|
454
|
+
),
|
|
455
|
+
rx.map(([serviceStats, appStats]) => ({
|
|
456
|
+
...appStats,
|
|
457
|
+
[serviceName]: serviceStats,
|
|
458
|
+
})),
|
|
442
459
|
rx.retryWhen((err$) =>
|
|
443
460
|
err$.pipe(
|
|
444
461
|
rx.tap((err) => logger.error({ err }, 'monitor.stats')),
|
|
@@ -452,27 +469,13 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
452
469
|
|
|
453
470
|
monitorProviders.stats$ = stats$
|
|
454
471
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
couch: couch?.stats,
|
|
463
|
-
lag: toobusy?.lag(),
|
|
464
|
-
memory: process.memoryUsage(),
|
|
465
|
-
utilization: performance.eventLoopUtilization?.(elu2, elu1),
|
|
466
|
-
heap: v8.getHeapStatistics(),
|
|
467
|
-
[serviceName]: stats,
|
|
468
|
-
},
|
|
469
|
-
'STATS',
|
|
470
|
-
)
|
|
471
|
-
elu1 = elu2
|
|
472
|
-
}
|
|
473
|
-
})
|
|
474
|
-
|
|
475
|
-
appDestroyers.unshift(subscription)
|
|
472
|
+
if (process.env.NODE_ENV === 'production') {
|
|
473
|
+
appDestroyers.unshift(
|
|
474
|
+
stats$.pipe(rx.auditTime(10e3)).subscribe((stats) => {
|
|
475
|
+
logger.debug(stats, 'STATS')
|
|
476
|
+
}),
|
|
477
|
+
)
|
|
478
|
+
}
|
|
476
479
|
}
|
|
477
480
|
|
|
478
481
|
let status$
|