Statistics

stats

PaginatedResult<Stats> stats(Hash options)

This call queries the REST /stats API and retrieves your application's usage statistics. A PaginatedResult is returned, containing an array of Stats for the first page of results. PaginatedResult objects are iterable providing a means to page through historical statistics. See an example set of raw stats returned via the REST API.

Parameters

ParameterDescriptionType
optionsAn optional object containing the query parametersHash
&blockyields a PaginatedResult<Stats> objectBlock

options parameters

The following options, as defined in the REST /stats API endpoint, are permitted:

PropertyDescriptionType
:startEarliest Time or time in milliseconds since the epoch for any stats retrieved.
Default: beginning of time
Int or Time
:endLatest Time or time in milliseconds since the epoch for any stats retrieved.
Default: current time
Int or Time
:direction:forwards or :backwards.
Default: backwards
Symbol
:limitMaximum number of stats to retrieve up to 1,000.
Default: 100
Integer
:unit:minute, :hour, :day or :month. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query.
Default: :minute
Symbol

Returns

On success, the returned PaginatedResult encapsulates an array of Stats objects corresponding to the current page of results. PaginatedResult supports pagination using next and first methods.

Failure to retrieve the stats will raise an AblyException

Ably::Models::Stats

A Stats object represents an application's statistics for the specified interval and time period. Ably aggregates statistics globally for all accounts and applications, and makes these available both through our statistics API as well as your application dashboard.

Please note that most attributes of the Stats type below contain references to further stats types. This documentation is not exhaustive for all stats types, and as such, links to the stats types below will take you to the Ruby library stats documentation which contains exhaustive stats documentation. Ruby and Python however uses under_score case instead of the default camelCase in most languages, so please bear that in mind.

Attributes

PropertyDescriptionType
unitthe length of the interval that this statistic covers, such as :minute, :hour, :day, :month.Stats::GRANULARITY
interval_granularityDeprecated alias for unit; scheduled to be removed in version 2.x client library versions.Stats::GRANULARITY
interval_idthe UTC time at which the time period covered by this Stats object starts. For example, an interval ID value of "2018-03-01:10" in a Stats object whose unit is day would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All Stats objects, except those whose unit is minute, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the unit by looking at the resolution of the interval_id. Stats objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02".String
interval_timeA Time object representing the parsed interval_id (the UTC time at which the time period covered by this Stats object starts)Time
allaggregate count of both inbound and outbound message statsMessageTypes
api_requestsbreakdown of API requests received via the Ably REST APIRequestCount
channelsbreakdown of channel related stats such as min, mean and peak channelsResourceCount
connectionsbreakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connectionsConnectionTypes
inboundstatistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messagesMessageTraffic
outboundstatistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messagesMessageTraffic
persistedmessages persisted and later retrieved via the history APIMessageTypes
token_requestsbreakdown of Ably Token requests received via the Ably REST API.RequestCount
pushDetailed stats on push notifications, see our Push documentation for more detailsPushStats