don't log metrics for postgres in testing
Some checks failed
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Lint / lint (frontend-embed) (pull_request) Blocked by required conditions
Lint / lint (frontend-shared) (pull_request) Blocked by required conditions
Lint / lint (misskey-bubble-game) (pull_request) Blocked by required conditions
Lint / lint (misskey-js) (pull_request) Blocked by required conditions
Lint / lint (misskey-reversi) (pull_request) Blocked by required conditions
Lint / lint (sw) (pull_request) Blocked by required conditions
Lint / typecheck (backend) (pull_request) Blocked by required conditions
Lint / typecheck (misskey-js) (pull_request) Blocked by required conditions
Lint / typecheck (sw) (pull_request) Blocked by required conditions
Lint / pnpm_install (push) Successful in 1m37s
Test (backend) / e2e (22.11.0) (push) Failing after 2m3s
Publish Docker image / Build (push) Successful in 5m6s
Test (production install and build) / production (22.11.0) (push) Successful in 1m27s
Test (backend) / unit (22.11.0) (push) Has been cancelled
Lint / lint (backend) (pull_request) Has been cancelled
Lint / lint (frontend) (pull_request) Has been cancelled
Lint / pnpm_install (pull_request) Has been cancelled
Publish Docker image / Build (pull_request) Has been cancelled
Test (backend) / e2e (22.11.0) (pull_request) Has been cancelled
Test (backend) / unit (22.11.0) (pull_request) Has been cancelled
Test (production install and build) / production (22.11.0) (pull_request) Has been cancelled
Some checks failed
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Lint / lint (frontend-embed) (pull_request) Blocked by required conditions
Lint / lint (frontend-shared) (pull_request) Blocked by required conditions
Lint / lint (misskey-bubble-game) (pull_request) Blocked by required conditions
Lint / lint (misskey-js) (pull_request) Blocked by required conditions
Lint / lint (misskey-reversi) (pull_request) Blocked by required conditions
Lint / lint (sw) (pull_request) Blocked by required conditions
Lint / typecheck (backend) (pull_request) Blocked by required conditions
Lint / typecheck (misskey-js) (pull_request) Blocked by required conditions
Lint / typecheck (sw) (pull_request) Blocked by required conditions
Lint / pnpm_install (push) Successful in 1m37s
Test (backend) / e2e (22.11.0) (push) Failing after 2m3s
Publish Docker image / Build (push) Successful in 5m6s
Test (production install and build) / production (22.11.0) (push) Successful in 1m27s
Test (backend) / unit (22.11.0) (push) Has been cancelled
Lint / lint (backend) (pull_request) Has been cancelled
Lint / lint (frontend) (pull_request) Has been cancelled
Lint / pnpm_install (pull_request) Has been cancelled
Publish Docker image / Build (pull_request) Has been cancelled
Test (backend) / e2e (22.11.0) (pull_request) Has been cancelled
Test (backend) / unit (22.11.0) (pull_request) Has been cancelled
Test (production install and build) / production (22.11.0) (pull_request) Has been cancelled
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
4d44adfaa9
commit
6b7f8edb96
2 changed files with 13 additions and 10 deletions
|
@ -31,16 +31,18 @@ export type UserWebhookDeliverQueue = Bull.Queue<UserWebhookDeliverJobData>;
|
|||
export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>;
|
||||
|
||||
function withMetrics<T>(queue: Bull.Queue<T>): Bull.Queue<T> {
|
||||
setInterval(async () => {
|
||||
mActiveJobs.set({ queue: queue.name }, await queue.getActiveCount());
|
||||
mDelayedJobs.set({ queue: queue.name }, await queue.getDelayedCount());
|
||||
mWaitingJobs.set({ queue: queue.name }, await queue.getWaitingCount());
|
||||
}, 2000);
|
||||
|
||||
queue.on('waiting', () => {
|
||||
mJobReceivedCounter.inc({ queue: queue.name });
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
setInterval(async () => {
|
||||
mActiveJobs.set({ queue: queue.name }, await queue.getActiveCount());
|
||||
mDelayedJobs.set({ queue: queue.name }, await queue.getDelayedCount());
|
||||
mWaitingJobs.set({ queue: queue.name }, await queue.getWaitingCount());
|
||||
}, 2000);
|
||||
|
||||
queue.on('waiting', () => {
|
||||
mJobReceivedCounter.inc({ queue: queue.name });
|
||||
});
|
||||
}
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,8 @@ export function createPostgresDataSource(config: Config, isMain = false) {
|
|||
},
|
||||
} : false,
|
||||
logging: log ? 'all' : ['query'],
|
||||
logger: (isMain || log) ? new MyCustomLogger(!log) : undefined,
|
||||
logger: process.env.NODE_ENV === 'test' ? undefined :
|
||||
(isMain || log) ? new MyCustomLogger(!log) : undefined,
|
||||
maxQueryExecutionTime: 500,
|
||||
entities: entities,
|
||||
migrations: ['../../migration/*.js'],
|
||||
|
|
Loading…
Reference in a new issue