aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/stat-manager.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-04-12 11:19:07 +0200
committerGitHub <noreply@github.com>2021-04-12 11:19:07 +0200
commitfe19f600dab0f6b00a7aa146ba4bd4bb96536155 (patch)
treebe388f89a41cbc257fc9a642a9205b4910b7a6b7 /server/lib/stat-manager.ts
parenta472cf033003cf96b69a80808b2dce1fe382e09b (diff)
downloadPeerTube-fe19f600dab0f6b00a7aa146ba4bd4bb96536155.tar.gz
PeerTube-fe19f600dab0f6b00a7aa146ba4bd4bb96536155.tar.zst
PeerTube-fe19f600dab0f6b00a7aa146ba4bd4bb96536155.zip
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
Diffstat (limited to 'server/lib/stat-manager.ts')
-rw-r--r--server/lib/stat-manager.ts27
1 files changed, 22 insertions, 5 deletions
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'
3import { ActorFollowModel } from '@server/models/activitypub/actor-follow' 3import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
4import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' 4import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'
5import { VideoModel } from '@server/models/video/video' 5import { VideoModel } from '@server/models/video/video'
6import { VideoChannelModel } from '@server/models/video/video-channel'
6import { VideoCommentModel } from '@server/models/video/video-comment' 7import { VideoCommentModel } from '@server/models/video/video-comment'
7import { VideoFileModel } from '@server/models/video/video-file' 8import { VideoFileModel } from '@server/models/video/video-file'
9import { VideoPlaylistModel } from '@server/models/video/video-playlist'
8import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models' 10import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models'
9 11
10class StatsManager { 12class StatsManager {
@@ -46,21 +48,36 @@ class StatsManager {
46 const { totalUsers, totalDailyActiveUsers, totalWeeklyActiveUsers, totalMonthlyActiveUsers } = await UserModel.getStats() 48 const { totalUsers, totalDailyActiveUsers, totalWeeklyActiveUsers, totalMonthlyActiveUsers } = await UserModel.getStats()
47 const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats() 49 const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats()
48 const { totalLocalVideoFilesSize } = await VideoFileModel.getStats() 50 const { totalLocalVideoFilesSize } = await VideoFileModel.getStats()
51 const {
52 totalLocalVideoChannels,
53 totalLocalDailyActiveVideoChannels,
54 totalLocalWeeklyActiveVideoChannels,
55 totalLocalMonthlyActiveVideoChannels
56 } = await VideoChannelModel.getStats()
57 const { totalLocalPlaylists } = await VideoPlaylistModel.getStats()
49 58
50 const videosRedundancyStats = await this.buildRedundancyStats() 59 const videosRedundancyStats = await this.buildRedundancyStats()
51 60
52 const data: ServerStats = { 61 const data: ServerStats = {
62 totalUsers,
63 totalDailyActiveUsers,
64 totalWeeklyActiveUsers,
65 totalMonthlyActiveUsers,
66
53 totalLocalVideos, 67 totalLocalVideos,
54 totalLocalVideoViews, 68 totalLocalVideoViews,
55 totalLocalVideoFilesSize,
56 totalLocalVideoComments, 69 totalLocalVideoComments,
70 totalLocalVideoFilesSize,
71
57 totalVideos, 72 totalVideos,
58 totalVideoComments, 73 totalVideoComments,
59 74
60 totalUsers, 75 totalLocalVideoChannels,
61 totalDailyActiveUsers, 76 totalLocalDailyActiveVideoChannels,
62 totalWeeklyActiveUsers, 77 totalLocalWeeklyActiveVideoChannels,
63 totalMonthlyActiveUsers, 78 totalLocalMonthlyActiveVideoChannels,
79
80 totalLocalPlaylists,
64 81
65 totalInstanceFollowers, 82 totalInstanceFollowers,
66 totalInstanceFollowing, 83 totalInstanceFollowing,