Skip to main content

api_insights_time_stats

Creates, updates, deletes, gets or lists an api_insights_time_stats resource.

Overview

Nameapi_insights_time_stats
TypeResource
Idgithub.orgs.api_insights_time_stats

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
rate_limited_request_countinteger (int64)
timestampstring
total_request_countinteger (int64)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_time_stats_by_actorselectorg, actor_type, actor_id, min_timestamp, timestamp_incrementmax_timestampGet the number of API requests and rate-limited requests made within an organization by a specific actor within a specified time period.
get_time_stats_by_userselectorg, user_id, min_timestamp, timestamp_incrementmax_timestampGet the number of API requests and rate-limited requests made within an organization by a specific user over a specified time period.
get_time_statsselectorg, min_timestamp, timestamp_incrementmax_timestampGet the number of API requests and rate-limited requests made within an organization over a specified time period.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
actor_idintegerThe ID of the actor
actor_typestringThe type of the actor
min_timestampstringThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
orgstringThe organization name. The name is not case sensitive.
timestamp_incrementstringThe increment of time used to breakdown the query results (5m, 10m, 1h, etc.)
user_idstringThe ID of the user to query for stats
max_timestampstringThe maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

SELECT examples

Get the number of API requests and rate-limited requests made within an organization by a specific actor within a specified time period.

SELECT
rate_limited_request_count,
timestamp,
total_request_count
FROM github.orgs.api_insights_time_stats
WHERE org = '{{ org }}' -- required
AND actor_type = '{{ actor_type }}' -- required
AND actor_id = '{{ actor_id }}' -- required
AND min_timestamp = '{{ min_timestamp }}' -- required
AND timestamp_increment = '{{ timestamp_increment }}' -- required
AND max_timestamp = '{{ max_timestamp }}'
;