notifications metrics
All checks were successful
Lint / pnpm_install (pull_request) Successful in 2m15s
Publish Docker image / Build (pull_request) Successful in 4m51s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m9s
Test (backend) / unit (22.11.0) (pull_request) Successful in 9m20s
Publish Docker image / Build (push) Successful in 4m48s
Lint / pnpm_install (push) Successful in 1m42s
Test (backend) / e2e (22.11.0) (pull_request) Successful in 12m21s
Test (production install and build) / production (22.11.0) (push) Successful in 1m4s
Test (backend) / unit (22.11.0) (push) Successful in 9m3s
Lint / lint (backend) (pull_request) Successful in 2m36s
Lint / lint (frontend) (pull_request) Successful in 2m31s
Lint / lint (frontend-embed) (pull_request) Successful in 2m32s
Test (backend) / e2e (22.11.0) (push) Successful in 12m43s
Lint / lint (frontend-shared) (pull_request) Successful in 2m45s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m45s
Lint / lint (misskey-js) (pull_request) Successful in 2m43s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m45s
Lint / lint (sw) (pull_request) Successful in 2m26s
Lint / typecheck (backend) (pull_request) Successful in 2m30s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m58s
Lint / typecheck (sw) (pull_request) Successful in 1m43s
Lint / lint (backend) (push) Successful in 2m44s
Lint / lint (frontend) (push) Successful in 2m36s
Lint / lint (frontend-embed) (push) Successful in 2m24s
Lint / lint (frontend-shared) (push) Successful in 2m45s
Lint / lint (misskey-bubble-game) (push) Successful in 2m34s
Lint / lint (misskey-js) (push) Successful in 2m33s
Lint / lint (misskey-reversi) (push) Successful in 2m30s
Lint / lint (sw) (push) Successful in 2m31s
Lint / typecheck (backend) (push) Successful in 2m25s
Lint / typecheck (misskey-js) (push) Successful in 1m44s
Lint / typecheck (sw) (push) Successful in 1m44s
All checks were successful
Lint / pnpm_install (pull_request) Successful in 2m15s
Publish Docker image / Build (pull_request) Successful in 4m51s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m9s
Test (backend) / unit (22.11.0) (pull_request) Successful in 9m20s
Publish Docker image / Build (push) Successful in 4m48s
Lint / pnpm_install (push) Successful in 1m42s
Test (backend) / e2e (22.11.0) (pull_request) Successful in 12m21s
Test (production install and build) / production (22.11.0) (push) Successful in 1m4s
Test (backend) / unit (22.11.0) (push) Successful in 9m3s
Lint / lint (backend) (pull_request) Successful in 2m36s
Lint / lint (frontend) (pull_request) Successful in 2m31s
Lint / lint (frontend-embed) (pull_request) Successful in 2m32s
Test (backend) / e2e (22.11.0) (push) Successful in 12m43s
Lint / lint (frontend-shared) (pull_request) Successful in 2m45s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m45s
Lint / lint (misskey-js) (pull_request) Successful in 2m43s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m45s
Lint / lint (sw) (pull_request) Successful in 2m26s
Lint / typecheck (backend) (pull_request) Successful in 2m30s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m58s
Lint / typecheck (sw) (pull_request) Successful in 1m43s
Lint / lint (backend) (push) Successful in 2m44s
Lint / lint (frontend) (push) Successful in 2m36s
Lint / lint (frontend-embed) (push) Successful in 2m24s
Lint / lint (frontend-shared) (push) Successful in 2m45s
Lint / lint (misskey-bubble-game) (push) Successful in 2m34s
Lint / lint (misskey-js) (push) Successful in 2m33s
Lint / lint (misskey-reversi) (push) Successful in 2m30s
Lint / lint (sw) (push) Successful in 2m31s
Lint / typecheck (backend) (push) Successful in 2m25s
Lint / typecheck (misskey-js) (push) Successful in 1m44s
Lint / typecheck (sw) (push) Successful in 1m44s
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
4b6ec86a00
commit
f0c0b75285
2 changed files with 26 additions and 0 deletions
|
@ -21,6 +21,13 @@ import type { Config } from '@/config.js';
|
|||
import { UserListService } from '@/core/UserListService.js';
|
||||
import type { FilterUnionByProperty } from '@/types.js';
|
||||
import { trackPromise } from '@/misc/promise-tracker.js';
|
||||
import { metricCounter } from '@/server/api/MetricsService.js';
|
||||
|
||||
const mNotificationsCreated = metricCounter({
|
||||
name: 'misskey_notifications_created',
|
||||
help: 'Notifications created',
|
||||
labelNames: ['event_type'],
|
||||
});
|
||||
|
||||
@Injectable()
|
||||
export class NotificationService implements OnApplicationShutdown {
|
||||
|
@ -165,6 +172,8 @@ export class NotificationService implements OnApplicationShutdown {
|
|||
|
||||
if (packed == null) return null;
|
||||
|
||||
mNotificationsCreated?.inc({ event_type: notification.type });
|
||||
|
||||
// Publish notification event
|
||||
this.globalEventService.publishMainStream(notifieeId, 'notification', packed);
|
||||
|
||||
|
|
|
@ -13,6 +13,19 @@ import { getNoteSummary } from '@/misc/get-note-summary.js';
|
|||
import type { MiMeta, MiSwSubscription, SwSubscriptionsRepository } from '@/models/_.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { RedisKVCache } from '@/misc/cache.js';
|
||||
import { metricCounter } from '@/server/api/MetricsService.js';
|
||||
|
||||
const mWebPushCreated = metricCounter({
|
||||
name: 'misskey_webpush_created',
|
||||
help: 'WebPush event',
|
||||
labelNames: ['event_type'],
|
||||
});
|
||||
|
||||
const mWebPushError = metricCounter({
|
||||
name: 'misskey_webpush_error',
|
||||
help: 'WebPush error',
|
||||
labelNames: ['event_type', 'status'],
|
||||
});
|
||||
|
||||
// Defined also packages/sw/types.ts#L13
|
||||
type PushNotificationsTypes = {
|
||||
|
@ -95,6 +108,8 @@ export class PushNotificationService implements OnApplicationShutdown {
|
|||
},
|
||||
};
|
||||
|
||||
mWebPushCreated?.inc({ event_type: type });
|
||||
|
||||
push.sendNotification(pushSubscription, JSON.stringify({
|
||||
type,
|
||||
body: (type === 'notification' || type === 'unreadAntennaNote') ? truncateBody(type, body) : body,
|
||||
|
@ -116,6 +131,8 @@ export class PushNotificationService implements OnApplicationShutdown {
|
|||
}).then(() => {
|
||||
this.refreshCache(userId);
|
||||
});
|
||||
} else {
|
||||
mWebPushError?.inc({ event_type: type, status: err.statusCode || 'unknown' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue