Tracking resources
GLIDE 1.2 introduces a new non-Valkey API: getStatistics which returns statistics 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)
from glide import ( NodeAddress, GlideClusterClientConfiguration, GlideClusterClient)
addresses = [NodeAddress(host="address.example.com", port=6379)]client_config = GlideClusterClientConfiguration(addresses, request_timeout=500)
client = await GlideClusterClient.create(client_config)
# Retrieve statisticsstats = await client.get_statistics()
# Example: Accessing and printing statisticsprint(f"Total Connections: {stats['total_connections']}")print(f"Total Clients: {stats['total_clients']}")import glide.api.GlideClusterClient;import glide.api.models.configuration.GlideClusterClientConfiguration;import glide.api.models.configuration.NodeAddress;
GlideClusterClient config = GlideClusterClientConfiguration.builder() .address(NodeAddress.builder() .host("address.example.com") .port(6379).build()) .requestTimeout(500) .build();
GlideClusterClient client = GlideClusterClient.createClient(config).get();HashMap<String, String> stats = client.getStatistics();// do something with the `stats`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}`);