diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-04-12 11:19:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 11:19:07 +0200 |
commit | fe19f600dab0f6b00a7aa146ba4bd4bb96536155 (patch) | |
tree | be388f89a41cbc257fc9a642a9205b4910b7a6b7 /server/lib | |
parent | a472cf033003cf96b69a80808b2dce1fe382e09b (diff) | |
download | PeerTube-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')
-rw-r--r-- | server/lib/stat-manager.ts | 27 |
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' | |||
3 | import { ActorFollowModel } from '@server/models/activitypub/actor-follow' | 3 | import { ActorFollowModel } from '@server/models/activitypub/actor-follow' |
4 | import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' | 4 | import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' |
5 | import { VideoModel } from '@server/models/video/video' | 5 | import { VideoModel } from '@server/models/video/video' |
6 | import { VideoChannelModel } from '@server/models/video/video-channel' | ||
6 | import { VideoCommentModel } from '@server/models/video/video-comment' | 7 | import { VideoCommentModel } from '@server/models/video/video-comment' |
7 | import { VideoFileModel } from '@server/models/video/video-file' | 8 | import { VideoFileModel } from '@server/models/video/video-file' |
9 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' | ||
8 | import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models' | 10 | import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models' |
9 | 11 | ||
10 | class StatsManager { | 12 | class 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, |