diff options
Diffstat (limited to 'server/controllers/api/metrics.ts')
-rw-r--r-- | server/controllers/api/metrics.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/server/controllers/api/metrics.ts b/server/controllers/api/metrics.ts deleted file mode 100644 index 909963fa7..000000000 --- a/server/controllers/api/metrics.ts +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | import express from 'express' | ||
2 | import { CONFIG } from '@server/initializers/config' | ||
3 | import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics' | ||
4 | import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models' | ||
5 | import { addPlaybackMetricValidator, apiRateLimiter, asyncMiddleware } from '../../middlewares' | ||
6 | |||
7 | const metricsRouter = express.Router() | ||
8 | |||
9 | metricsRouter.use(apiRateLimiter) | ||
10 | |||
11 | metricsRouter.post('/playback', | ||
12 | asyncMiddleware(addPlaybackMetricValidator), | ||
13 | addPlaybackMetric | ||
14 | ) | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | export { | ||
19 | metricsRouter | ||
20 | } | ||
21 | |||
22 | // --------------------------------------------------------------------------- | ||
23 | |||
24 | function addPlaybackMetric (req: express.Request, res: express.Response) { | ||
25 | if (!CONFIG.OPEN_TELEMETRY.METRICS.ENABLED) { | ||
26 | return res.sendStatus(HttpStatusCode.FORBIDDEN_403) | ||
27 | } | ||
28 | |||
29 | const body: PlaybackMetricCreate = req.body | ||
30 | |||
31 | OpenTelemetryMetrics.Instance.observePlaybackMetric(res.locals.onlyImmutableVideo, body) | ||
32 | |||
33 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) | ||
34 | } | ||