1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add playback metric endpoint sent to OTEL

This commit is contained in:
Chocobozzz 2022-08-12 16:41:29 +02:00
parent 0e6cd1c00f
commit fd3c2e8705
No known key found for this signature in database
GPG key ID: 583A612D890159BE
35 changed files with 748 additions and 127 deletions

View file

@ -5,6 +5,7 @@ export * from './follows-command'
export * from './follows'
export * from './jobs'
export * from './jobs-command'
export * from './metrics-command'
export * from './object-storage-command'
export * from './plugins-command'
export * from './redundancy-command'

View file

@ -0,0 +1,18 @@
import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class MetricsCommand extends AbstractCommand {
addPlaybackMetric (options: OverrideCommandOptions & { metrics: PlaybackMetricCreate }) {
const path = '/api/v1/metrics/playback'
return this.postBodyRequest({
...options,
path,
fields: options.metrics,
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
})
}
}

View file

@ -37,6 +37,7 @@ import { ContactFormCommand } from './contact-form-command'
import { DebugCommand } from './debug-command'
import { FollowsCommand } from './follows-command'
import { JobsCommand } from './jobs-command'
import { MetricsCommand } from './metrics-command'
import { ObjectStorageCommand } from './object-storage-command'
import { PluginsCommand } from './plugins-command'
import { RedundancyCommand } from './redundancy-command'
@ -104,6 +105,7 @@ export class PeerTubeServer {
debug?: DebugCommand
follows?: FollowsCommand
jobs?: JobsCommand
metrics?: MetricsCommand
plugins?: PluginsCommand
redundancy?: RedundancyCommand
stats?: StatsCommand
@ -377,6 +379,7 @@ export class PeerTubeServer {
this.debug = new DebugCommand(this)
this.follows = new FollowsCommand(this)
this.jobs = new JobsCommand(this)
this.metrics = new MetricsCommand(this)
this.plugins = new PluginsCommand(this)
this.redundancy = new RedundancyCommand(this)
this.stats = new StatsCommand(this)