Fix usability issues for queue and inbox error metrics #26
3 changed files with 9 additions and 2 deletions
|
@ -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<Record<string, unknown>>;
|
||||
export type EndedPollNotificationQueue = Bull.Queue<EndedPollNotificationJobData>;
|
||||
|
@ -36,6 +36,7 @@ function withMetrics<T>(queue: Bull.Queue<T>): Bull.Queue<T> {
|
|||
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', () => {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue