Docs - Endpoints

Stats

Warning
The Autoscaler is currently in Beta and may experience changes, quirks, and downtime.

Both endptgroups and autogroups track a number of different metrics relating to their performance over time.

The list of the currently tracked metrics are:

  • nworkers: Current number of workers in the autogroup.
  • totreqs: Total number of requests your autogroup has served.
  • curload: The rate at which requested work units are coming in to the server (work units per second).
  • capacity: The total number of requested work units your autogroup can handle.
  • reliable: Average rate of success for requests sent to workers in your autogroup.
  • reqrate: The rate at which new requests are coming into your autogroup.

The /get_endpoint_stats/ and /get_autogroup_stats/ endpoints return these metrics in one of two modes.

Inputs #

/get_endpoint_stats/ #

  • One of the following:
    • id: ID of your endpoint group
    • endpoint: Name of your endpoint group
  • api_key: The API_KEY corresponding to your endpoint group used for authentication purposes

/get_autogroup_stats/ #

  • id: ID of your autogroup
  • api_key: The API_KEY corresponding to your autogroup used for authentication purposes

If you include only these parameters in your request, the endpoint will return the current value for all of these metrics.

Example Output #

1 2 3 4 5 6 7 8 9 10 { "capacity": 8306.60345739313, "curload": 9250.0, "endpoint": "test-local", "id": 28, "nworkers": 44, "reliable": 0.9942605208097545, "reqrate": 31.918882596395715, "totreqs": 8603534 }

If you are interested in getting results for a specific metric over a specific time range, you can use this endpoint in "timeseries" mode by supplying these extra parameters:

  • metric_name: Name of the metric you are querying
  • t1: Start timepoint of the timeseries
  • t2: End timepoint of the timeseries

Example: Calling the /get_autogroup_stats/ Endpoint in "Timeseries" Mode #

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 import requests import json stats_payload = { "id": 28, "metric_name": "nworkers", "t1": 5000, "t2": 5010, "api_key": "API_KEY_HERE" } response = requests.post( "https://run.vast.ai/get_autogroup_stats/", headers={"Content-Type": "application/json"}, data=json.dumps(stats_payload), timeout=4 ) if response.status_code != 200: print(f"Failed to call /get_autogroup_stats/, response.status_code: {response.status_code}") return

Example: Calling the /get_autogroup_stats/ Endpoint with cURL #

1 curl https://run.vast.ai/get_autogroup_stats/ \n-X POST \n-d '{"id" : 28, "api_key" : "API_KEY_HERE", "metric_name" : "nworkers", "t1": 5000, "t2" : 5010}' \n-H 'Content-Type: application/json'

Example Response #

1 2 3 4 5 6 7 8 9 { "endpoint": "test-local", "id": 28, "nworkers": [ 8.0, 8.0 ], "range_len": 2 }

Note that the t1 and t2 timestamps are measured in seconds and are relative to the UNIX Epoch.