aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/formatter
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/formatter')
-rw-r--r--server/models/video/formatter/video-format-utils.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts
index 6222107d7..fd02f8c64 100644
--- a/server/models/video/formatter/video-format-utils.ts
+++ b/server/models/video/formatter/video-format-utils.ts
@@ -1,5 +1,6 @@
1import { generateMagnetUri } from '@server/helpers/webtorrent' 1import { generateMagnetUri } from '@server/helpers/webtorrent'
2import { getActivityStreamDuration } from '@server/lib/activitypub/activity' 2import { getActivityStreamDuration } from '@server/lib/activitypub/activity'
3import { tracer } from '@server/lib/opentelemetry/tracing'
3import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls' 4import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls'
4import { VideoViewsManager } from '@server/lib/views/video-views-manager' 5import { VideoViewsManager } from '@server/lib/views/video-views-manager'
5import { uuidToShort } from '@shared/extra-utils' 6import { uuidToShort } from '@shared/extra-utils'
@@ -71,6 +72,8 @@ function guessAdditionalAttributesFromQuery (query: VideosCommonQueryAfterSaniti
71} 72}
72 73
73function videoModelToFormattedJSON (video: MVideoFormattable, options: VideoFormattingJSONOptions = {}): Video { 74function videoModelToFormattedJSON (video: MVideoFormattable, options: VideoFormattingJSONOptions = {}): Video {
75 const span = tracer.startSpan('peertube.VideoModel.toFormattedJSON')
76
74 const userHistory = isArray(video.UserVideoHistories) ? video.UserVideoHistories[0] : undefined 77 const userHistory = isArray(video.UserVideoHistories) ? video.UserVideoHistories[0] : undefined
75 78
76 const videoObject: Video = { 79 const videoObject: Video = {
@@ -168,10 +171,14 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options: VideoForm
168 videoObject.files = videoFilesModelToFormattedJSON(video, video.VideoFiles) 171 videoObject.files = videoFilesModelToFormattedJSON(video, video.VideoFiles)
169 } 172 }
170 173
174 span.end()
175
171 return videoObject 176 return videoObject
172} 177}
173 178
174function videoModelToFormattedDetailsJSON (video: MVideoFormattableDetails): VideoDetails { 179function videoModelToFormattedDetailsJSON (video: MVideoFormattableDetails): VideoDetails {
180 const span = tracer.startSpan('peertube.VideoModel.toFormattedDetailsJSON')
181
175 const videoJSON = video.toFormattedJSON({ 182 const videoJSON = video.toFormattedJSON({
176 additionalAttributes: { 183 additionalAttributes: {
177 scheduledUpdate: true, 184 scheduledUpdate: true,
@@ -199,6 +206,8 @@ function videoModelToFormattedDetailsJSON (video: MVideoFormattableDetails): Vid
199 trackerUrls: video.getTrackerUrls() 206 trackerUrls: video.getTrackerUrls()
200 } 207 }
201 208
209 span.end()
210
202 return Object.assign(videoJSON, detailsJSON) 211 return Object.assign(videoJSON, detailsJSON)
203} 212}
204 213