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:
parent
a472cf0330
commit
fe19f600da
5 changed files with 193 additions and 24 deletions
|
@ -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,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue