API v 1.2
JavaScript

Statistics

This call queries the Ably REST /stats API endpoint 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

options
an optional object containing the query parameters
callback
is a function of the form: function(err, result)

options parameters

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

start
beginning of time earliest time in milliseconds since the epoch for any stats retrievedType: Long
end
current time latest time in milliseconds since the epoch for any stats retrievedType: Long
direction
backwards forwards or backwardsType: String
limit
100 maximum number of messages to retrieve up to 1,000Type: Integer
unit
minute 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 queryType: String

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.

Properties

unit
the length of the interval that this statistic covers, such as 'minute', 'hour', 'day', 'month'.Type: String
intervalId
the 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 intervalId. Stats objects covering an individual minute will have an interval ID indicating that time; for example “2018-03-01:10:02″.Type: String
all
aggregate count of both inbound and outbound message statsType: MessageTypes
apiRequests
breakdown of API requests received via the Ably REST APIType: RequestCount
channels
breakdown of channel related stats such as min, mean and peak channelsType: ResourceCount
connections
breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connectionsType: ConnectionTypes
inbound
statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messagesType: MessageTraffic
outbound
statistics 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 messagesType: MessageTraffic
persisted
messages persisted and later retrieved via the history APIType: MessageTypes
tokenRequests
breakdown of Ably Token requests received via the Ably REST API.Type: RequestCount
push
Detailed stats on push notifications, see our Push documentation for more detailsType: PushStats