|
|
@@ -2,6 +2,7 @@ import express from 'express' |
|
|
|
import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics' |
|
|
|
import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models' |
|
|
|
import { addPlaybackMetricValidator, asyncMiddleware } from '../../middlewares' |
|
|
|
import { CONFIG } from '@server/initializers/config' |
|
|
|
|
|
|
|
const metricsRouter = express.Router() |
|
|
|
|
|
|
@@ -19,6 +20,10 @@ export { |
|
|
|
// --------------------------------------------------------------------------- |
|
|
|
|
|
|
|
function addPlaybackMetric (req: express.Request, res: express.Response) { |
|
|
|
if (!CONFIG.OPEN_TELEMETRY.METRICS.ENABLED) { |
|
|
|
return res.sendStatus(HttpStatusCode.FORBIDDEN_403) |
|
|
|
} |
|
|
|
|
|
|
|
const body: PlaybackMetricCreate = req.body |
|
|
|
|
|
|
|
OpenTelemetryMetrics.Instance.observePlaybackMetric(res.locals.onlyImmutableVideo, body) |
|
|
|