Selva Compute API Reference - v1.1.2
    Preparing search index...

    Class ComputeServerStats

    ComputeServerStats provides methods to query Rhino Compute server statistics.

    Use this for server health monitoring and statistics.

    const stats = new ComputeServerStats('http://localhost:6500', 'your-api-key');

    try {
    const isOnline = await stats.isServerOnline();
    const children = await stats.getActiveChildren();
    const version = await stats.getVersion();

    // Or get everything at once
    const allStats = await stats.getServerStats();
    } finally {
    await stats.dispose(); // Clean up resources
    }
    Index

    Constructors

    Methods

    • Get the number of active child processes on the server.

      Returns Promise<number | null>

      Number of active children, or null if unavailable

    • Get comprehensive server statistics. Fetches all available server information in parallel.

      Returns Promise<
          {
              activeChildren?: number;
              isOnline: boolean;
              version?: { compute: string; git_sha: string
              | null; rhino: string };
          },
      >

      Object containing server status and available stats

    • Get the server version information.

      Returns Promise<{ compute: string; git_sha: string | null; rhino: string } | null>

      Version object with rhino, compute, and git_sha, or null if unavailable

    • Continuously monitor server stats at specified interval.

      Parameters

      • callback: (
            stats: {
                activeChildren?: number;
                isOnline: boolean;
                version?: { compute: string; git_sha: string | null; rhino: string };
            },
        ) => void

        Function called with stats on each interval

      • intervalMs: number = 5000

        Milliseconds between checks (default: 5000)

      Returns () => void

      Function to stop monitoring

      const stopMonitoring = stats.monitor((data) => {
      console.log('Server stats:', data);
      }, 3000);

      // Later...
      stopMonitoring();