aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/server/index.ts1
-rw-r--r--shared/server-commands/server/metrics-command.ts18
-rw-r--r--shared/server-commands/server/server.ts3
3 files changed, 22 insertions, 0 deletions
diff --git a/shared/server-commands/server/index.ts b/shared/server-commands/server/index.ts
index 0a4b21fc4..9a2fbf8d3 100644
--- a/shared/server-commands/server/index.ts
+++ b/shared/server-commands/server/index.ts
@@ -5,6 +5,7 @@ export * from './follows-command'
5export * from './follows' 5export * from './follows'
6export * from './jobs' 6export * from './jobs'
7export * from './jobs-command' 7export * from './jobs-command'
8export * from './metrics-command'
8export * from './object-storage-command' 9export * from './object-storage-command'
9export * from './plugins-command' 10export * from './plugins-command'
10export * from './redundancy-command' 11export * from './redundancy-command'
diff --git a/shared/server-commands/server/metrics-command.ts b/shared/server-commands/server/metrics-command.ts
new file mode 100644
index 000000000..d22b4833d
--- /dev/null
+++ b/shared/server-commands/server/metrics-command.ts
@@ -0,0 +1,18 @@
1import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models'
2import { AbstractCommand, OverrideCommandOptions } from '../shared'
3
4export class MetricsCommand extends AbstractCommand {
5
6 addPlaybackMetric (options: OverrideCommandOptions & { metrics: PlaybackMetricCreate }) {
7 const path = '/api/v1/metrics/playback'
8
9 return this.postBodyRequest({
10 ...options,
11
12 path,
13 fields: options.metrics,
14 implicitToken: false,
15 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
16 })
17 }
18}
diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts
index c05d16ad2..2b4c9c9f8 100644
--- a/shared/server-commands/server/server.ts
+++ b/shared/server-commands/server/server.ts
@@ -37,6 +37,7 @@ import { ContactFormCommand } from './contact-form-command'
37import { DebugCommand } from './debug-command' 37import { DebugCommand } from './debug-command'
38import { FollowsCommand } from './follows-command' 38import { FollowsCommand } from './follows-command'
39import { JobsCommand } from './jobs-command' 39import { JobsCommand } from './jobs-command'
40import { MetricsCommand } from './metrics-command'
40import { ObjectStorageCommand } from './object-storage-command' 41import { ObjectStorageCommand } from './object-storage-command'
41import { PluginsCommand } from './plugins-command' 42import { PluginsCommand } from './plugins-command'
42import { RedundancyCommand } from './redundancy-command' 43import { RedundancyCommand } from './redundancy-command'
@@ -104,6 +105,7 @@ export class PeerTubeServer {
104 debug?: DebugCommand 105 debug?: DebugCommand
105 follows?: FollowsCommand 106 follows?: FollowsCommand
106 jobs?: JobsCommand 107 jobs?: JobsCommand
108 metrics?: MetricsCommand
107 plugins?: PluginsCommand 109 plugins?: PluginsCommand
108 redundancy?: RedundancyCommand 110 redundancy?: RedundancyCommand
109 stats?: StatsCommand 111 stats?: StatsCommand
@@ -377,6 +379,7 @@ export class PeerTubeServer {
377 this.debug = new DebugCommand(this) 379 this.debug = new DebugCommand(this)
378 this.follows = new FollowsCommand(this) 380 this.follows = new FollowsCommand(this)
379 this.jobs = new JobsCommand(this) 381 this.jobs = new JobsCommand(this)
382 this.metrics = new MetricsCommand(this)
380 this.plugins = new PluginsCommand(this) 383 this.plugins = new PluginsCommand(this)
381 this.redundancy = new RedundancyCommand(this) 384 this.redundancy = new RedundancyCommand(this)
382 this.stats = new StatsCommand(this) 385 this.stats = new StatsCommand(this)