From fe19f600dab0f6b00a7aa146ba4bd4bb96536155 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 12 Apr 2021 11:19:07 +0200 Subject: add channel and playlist stats to server stats endpoint (#3747) * add channel and playlist stats to nodeinfo * add tests for active video channels stats * fix tests for active channel stats --- server/lib/stat-manager.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'server/lib/stat-manager.ts') diff --git a/server/lib/stat-manager.ts b/server/lib/stat-manager.ts index 547d7a56b..09ba208bd 100644 --- a/server/lib/stat-manager.ts +++ b/server/lib/stat-manager.ts @@ -3,8 +3,10 @@ import { UserModel } from '@server/models/account/user' import { ActorFollowModel } from '@server/models/activitypub/actor-follow' import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' import { VideoModel } from '@server/models/video/video' +import { VideoChannelModel } from '@server/models/video/video-channel' import { VideoCommentModel } from '@server/models/video/video-comment' import { VideoFileModel } from '@server/models/video/video-file' +import { VideoPlaylistModel } from '@server/models/video/video-playlist' import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models' class StatsManager { @@ -46,21 +48,36 @@ class StatsManager { const { totalUsers, totalDailyActiveUsers, totalWeeklyActiveUsers, totalMonthlyActiveUsers } = await UserModel.getStats() const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats() const { totalLocalVideoFilesSize } = await VideoFileModel.getStats() + const { + totalLocalVideoChannels, + totalLocalDailyActiveVideoChannels, + totalLocalWeeklyActiveVideoChannels, + totalLocalMonthlyActiveVideoChannels + } = await VideoChannelModel.getStats() + const { totalLocalPlaylists } = await VideoPlaylistModel.getStats() const videosRedundancyStats = await this.buildRedundancyStats() const data: ServerStats = { + totalUsers, + totalDailyActiveUsers, + totalWeeklyActiveUsers, + totalMonthlyActiveUsers, + totalLocalVideos, totalLocalVideoViews, - totalLocalVideoFilesSize, totalLocalVideoComments, + totalLocalVideoFilesSize, + totalVideos, totalVideoComments, - totalUsers, - totalDailyActiveUsers, - totalWeeklyActiveUsers, - totalMonthlyActiveUsers, + totalLocalVideoChannels, + totalLocalDailyActiveVideoChannels, + totalLocalWeeklyActiveVideoChannels, + totalLocalMonthlyActiveVideoChannels, + + totalLocalPlaylists, totalInstanceFollowers, totalInstanceFollowing, -- cgit v1.2.3