"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ViewersObserversBuilder = void 0;
const video_views_manager_1 = require("../../views/video-views-manager");
class ViewersObserversBuilder {
    constructor(meter) {
        this.meter = meter;
    }
    buildObservers() {
        this.meter.createObservableGauge('peertube_viewers_total', {
            description: 'Total viewers on the instance'
        }).addCallback(observableResult => {
            for (const viewerScope of ['local', 'remote']) {
                for (const videoScope of ['local', 'remote']) {
                    const result = video_views_manager_1.VideoViewsManager.Instance.getTotalViewers({ viewerScope, videoScope });
                    observableResult.observe(result, { viewerOrigin: viewerScope, videoOrigin: videoScope });
                }
            }
        });
    }
}
exports.ViewersObserversBuilder = ViewersObserversBuilder;
//# sourceMappingURL=viewers-observers-builder.js.map