1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

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
This commit is contained in:
Rigel Kent 2021-04-12 11:19:07 +02:00 committed by GitHub
parent a472cf0330
commit fe19f600da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 193 additions and 24 deletions

View file

@ -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,22 +48,37 @@ 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 = {
totalLocalVideos,
totalLocalVideoViews,
totalLocalVideoFilesSize,
totalLocalVideoComments,
totalVideos,
totalVideoComments,
totalUsers,
totalDailyActiveUsers,
totalWeeklyActiveUsers,
totalMonthlyActiveUsers,
totalLocalVideos,
totalLocalVideoViews,
totalLocalVideoComments,
totalLocalVideoFilesSize,
totalVideos,
totalVideoComments,
totalLocalVideoChannels,
totalLocalDailyActiveVideoChannels,
totalLocalWeeklyActiveVideoChannels,
totalLocalMonthlyActiveVideoChannels,
totalLocalPlaylists,
totalInstanceFollowers,
totalInstanceFollowing,