Tracking resources
GLIDE 1.2 introduces a new NONE Valkey API: getStatistics which returns an Object with (currently) 2 properties (available for both GlideClient & GlideClusterClient):
total_connectionscontains the number of active connections across all clientstotal_clientscontains the number of active clients (regardless of its type)
import {GlideClusterClient} from "@valkey/valkey-glide";
const addresses = [ { host: "address.example.com", port: 6379 }];
const client = await GlideClusterClient.createClient({ addresses: addresses, requestTimeout: 500});
// Retrieve statisticsconst stats = await client.getStatistics();
// Example: Accessing and printing statisticsconsole.log(`Total Connections: ${stats.total_connections}`);console.log(`Total Clients: ${stats.total_clients}`);