Skip to content

Commit

Permalink
perf(cu): use work queue size to instrument pending tasks in worker m…
Browse files Browse the repository at this point in the history
…etrics
  • Loading branch information
TillaTheHun0 committed Aug 2, 2024
1 parent 154b4ec commit 408089a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions servers/cu/src/domain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,26 @@ export const createApis = async (ctx) => {
const stats = statsWith({
gauge,
loadWorkerStats: () => ({
primary: primaryWorkerPool.stats(),
dryRun: dryRunWorkerPool.stats()
primary: ({
...primaryWorkerPool.stats(),
/**
* We use a work queue on the main thread while keeping
* worker pool queues empty (see comment above)
*
* So we use the work queue size to report pending tasks
*/
pendingTasks: primaryWorkQueue.size
}),
dryRun: ({
...dryRunWorkerPool.stats(),
/**
* We use a work queue on the main thread while keeping
* worker pool queues empty (see comment above)
*
* So we use the work queue size to report pending tasks
*/
pendingTasks: dryRunWorkQueue.size
})
}),
/**
* https://nodejs.org/api/process.html#processmemoryusage
Expand Down

0 comments on commit 408089a

Please sign in to comment.