GET
/
v1
/
rpcUsageMetrics
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";

const avaCloudSDK = new AvaCloudSDK({
  chainId: "43114",
  network: "mainnet",
});

async function run() {
  const result = await avaCloudSDK.data.usageMetrics.getRpcUsageMetrics({
    timeInterval: "daily",
    startTimestamp: 1698100000,
    endTimestamp: 1698300000,
    groupBy: "rpcMethod",
  });

  // Handle the result
  console.log(result);
}

run();
{
  "aggregateDuration": "<string>",
  "metrics": [
    {
      "timestamp": 123,
      "values": [
        {
          "totalRequests": 123,
          "apiCreditsUsed": 123,
          "requestsPerSecond": 123,
          "successRatePercent": 123,
          "medianResponseTimeMsecs": 123,
          "invalidRequests": 123,
          "apiCreditsWasted": 123,
          "groupedBy": "rpcMethod",
          "groupValue": "<string>"
        }
      ]
    }
  ],
  "chainId": "<string>"
}

Authorizations

x-glacier-api-key
string
header
required

Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.

Query Parameters

timeInterval
enum<string>

Time interval granularity for data aggregation for subnet rpc metrics

Available options:
hourly,
daily,
weekly,
monthly
startTimestamp
integer

The start time of the range as a UNIX timestamp. The requested start time will be rounded down to 0:00 UTC of the day.

Required range: x > 0
endTimestamp
integer

The end time of the range as a UNIX timestamp. The requested end time will be rounded down to 0:00 UTC of the day.

Required range: x > 0
groupBy
enum<string>

Query param for the criterion used for grouping metrics

Available options:
rpcMethod,
responseCode,
rlBypassToken
chainId
string

Filter data by chain ID.

responseCode
string

Filter data by response status code.

rpcMethod
string

Filter data by RPC method.

rlBypassApiToken
string

Filter data by Rl Bypass API Token.

Response

200
application/json
Successful response
aggregateDuration
string
required

Duration in which the metrics value is aggregated

metrics
object[]
required

Metrics values

chainId
string
required

ChainId for which the metrics are aggregated