How to use the matrix-appservice-bridge.PrometheusMetrics.AgeCounters function in matrix-appservice-bridge

To help you get started, we’ve selected a few matrix-appservice-bridge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matrix-org / matrix-appservice-slack / src / Main.ts View on Github external
this.bridge.registerBridgeGauges(() => {
            const now = Date.now() / 1000;

            const remoteRoomsByAge = new PrometheusMetrics.AgeCounters();
            const matrixRoomsByAge = new PrometheusMetrics.AgeCounters();

            this.rooms.all.forEach((room) => {
                remoteRoomsByAge.bump(now - room.RemoteATime!);
                matrixRoomsByAge.bump(now - room.MatrixATime!);
            });

            const countAges = (users: QuickLRU) => {
                const counts = new PrometheusMetrics.AgeCounters();
                const snapshot = [...users.values()].filter((u) => u !== undefined && u.aTime! > 0);
                for (const user of snapshot) {
                    counts.bump(now - user.aTime!);
                }
                return counts;
            };

            return {
github matrix-org / matrix-appservice-slack / src / Main.ts View on Github external
const countAges = (users: QuickLRU) => {
                const counts = new PrometheusMetrics.AgeCounters();
                const snapshot = [...users.values()].filter((u) => u !== undefined && u.aTime! > 0);
                for (const user of snapshot) {
                    counts.bump(now - user.aTime!);
                }
                return counts;
            };
github matrix-org / matrix-appservice-slack / src / Main.ts View on Github external
this.bridge.registerBridgeGauges(() => {
            const now = Date.now() / 1000;

            const remoteRoomsByAge = new PrometheusMetrics.AgeCounters();
            const matrixRoomsByAge = new PrometheusMetrics.AgeCounters();

            this.rooms.all.forEach((room) => {
                remoteRoomsByAge.bump(now - room.RemoteATime!);
                matrixRoomsByAge.bump(now - room.MatrixATime!);
            });

            const countAges = (users: QuickLRU) => {
                const counts = new PrometheusMetrics.AgeCounters();
                const snapshot = [...users.values()].filter((u) => u !== undefined && u.aTime! > 0);
                for (const user of snapshot) {
                    counts.bump(now - user.aTime!);
                }
                return counts;
            };