"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LivesObserversBuilder = void 0;
const tslib_1 = require("tslib");
const video_1 = require("../../../models/video/video");
class LivesObserversBuilder {
    constructor(meter) {
        this.meter = meter;
    }
    buildObservers() {
        this.meter.createObservableGauge('peertube_running_lives_total', {
            description: 'Total running lives on the instance'
        }).addCallback((observableResult) => tslib_1.__awaiter(this, void 0, void 0, function* () {
            const local = yield video_1.VideoModel.countLives({ remote: false, mode: 'published' });
            const remote = yield video_1.VideoModel.countLives({ remote: true, mode: 'published' });
            observableResult.observe(local, { liveOrigin: 'local' });
            observableResult.observe(remote, { liveOrigin: 'remote' });
        }));
    }
}
exports.LivesObserversBuilder = LivesObserversBuilder;
//# sourceMappingURL=lives-observers-builder.js.map