Skip to content

Commit

Permalink
server: add ott_balancer_connections metric (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Apr 29, 2024
1 parent aa795a2 commit 6c38cf4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/balancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import roommanager from "./roommanager";
import type { RoomListItem } from "./api/room";
import _ from "lodash";
import type { MsgB2M, MsgM2B, UnloadReason } from "./generated";
import { Gauge } from "prom-client";
export type { MsgB2M, MsgM2B };

const log = getLogger("balancer");
Expand Down Expand Up @@ -435,3 +436,11 @@ function gossip() {
const gossipDebounced = _.debounce(gossip, 1000 * 20, { trailing: true, maxWait: 1000 * 20 });

interface GossipRoom extends RoomListItem {}

const gaugeBalancerConnections = new Gauge({
name: "ott_balancer_connections",
help: "Number of balancer connections",
collect() {
this.set(balancerManager.balancerConnections.length);
},
});

0 comments on commit 6c38cf4

Please sign in to comment.