mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat(server): add immich.users.total metric (#21780)
* Add immich.users.total metric * Fix tests & one lint error * Lint * Fix SQL Schema checks * Fix nit * Use workers argument in OnEvent hook and remove condition from method body
This commit is contained in:
@@ -102,6 +102,7 @@ export class UserAdminService extends BaseService {
|
||||
|
||||
const status = force ? UserStatus.Removing : UserStatus.Deleted;
|
||||
const user = await this.userRepository.update(id, { status, deletedAt: new Date() });
|
||||
this.telemetryRepository.api.addToGauge(`immich.users.total`, -1);
|
||||
|
||||
if (force) {
|
||||
await this.jobRepository.queue({ name: JobName.UserDelete, data: { id: user.id, force } });
|
||||
@@ -114,6 +115,7 @@ export class UserAdminService extends BaseService {
|
||||
await this.findOrFail(id, { withDeleted: true });
|
||||
await this.albumRepository.restoreAll(id);
|
||||
const user = await this.userRepository.restore(id);
|
||||
this.telemetryRepository.api.addToGauge('immich.users.total', 1);
|
||||
return mapUserAdmin(user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user