diff --git a/packages/backend/src/core/QueueModule.ts b/packages/backend/src/core/QueueModule.ts index f27fa8f3f4..f8e89684af 100644 --- a/packages/backend/src/core/QueueModule.ts +++ b/packages/backend/src/core/QueueModule.ts @@ -18,7 +18,7 @@ import { SystemWebhookDeliverJobData, } from '../queue/types.js'; import type { Provider } from '@nestjs/common'; -import { mActiveJobs, mDelayedJobs, mJobBlockedCounter, mWaitingJobs } from '@/queue/metrics.js'; +import { mActiveJobs, mDelayedJobs, mFailedJobs, mJobBlockedCounter, mWaitingJobs } from '@/queue/metrics.js'; export type SystemQueue = Bull.Queue>; export type EndedPollNotificationQueue = Bull.Queue; @@ -36,6 +36,7 @@ function withMetrics(queue: Bull.Queue): Bull.Queue { mActiveJobs?.set({ queue: queue.name }, await queue.getActiveCount()); mDelayedJobs?.set({ queue: queue.name }, await queue.getDelayedCount()); mWaitingJobs?.set({ queue: queue.name }, await queue.getWaitingCount()); + mFailedJobs?.set({ queue: queue.name }, await queue.getFailedCount()); }, 2000); queue.on('waiting', () => { diff --git a/packages/backend/src/queue/metrics.ts b/packages/backend/src/queue/metrics.ts index 2fa20a1754..ec658d2653 100644 --- a/packages/backend/src/queue/metrics.ts +++ b/packages/backend/src/queue/metrics.ts @@ -24,6 +24,12 @@ export const mWaitingJobs = metricGauge({ labelNames: ['queue'], }); +export const mFailedJobs = metricGauge({ + name: 'misskey_queue_failed_jobs', + help: 'Total number of failed jobs', + labelNames: ['queue'], +}); + export const mStalledWorkerCounter = metricCounter({ name: 'misskey_queue_stalled_workers_total', help: 'Total number of stalled workers', diff --git a/packages/backend/src/queue/processors/InboxProcessorService.ts b/packages/backend/src/queue/processors/InboxProcessorService.ts index a98e37376a..2e674b0548 100644 --- a/packages/backend/src/queue/processors/InboxProcessorService.ts +++ b/packages/backend/src/queue/processors/InboxProcessorService.ts @@ -152,9 +152,9 @@ export class InboxProcessorService implements OnApplicationShutdown { // 対象が4xxならスキップ if (err instanceof StatusError) { if (!err.isRetryable) { - incCounter(mIncomingApReject, { reason: 'actor_key_unresolvable' }); throw new Bull.UnrecoverableError(`skip: Ignored deleted actors on both ends ${activity.actor} - ${err.statusCode}`); } + incCounter(mIncomingApReject, { reason: 'actor_key_unresolvable' }); throw new Error(`Error in actor ${activity.actor} - ${err.statusCode}`); } }