Query and event stats

Responses from Fauna Core HTTP API endpoints include stats showing how the related query request or events was processed.

You can use these stats to monitor resource consumption, track performance metrics, and troubleshoot errors.

Query stats

Successful responses and errors from the Query endpoint include a stats object:

{
  ...,
  "stats": {
    "compute_ops": 1,
    "read_ops": 1,
    "write_ops": 0,
    "query_time_ms": 68,
    "contention_retries": 0,
    "storage_bytes_read": 12106,
    "storage_bytes_write": 0,
    "rate_limits_hit": []
  },
  ...
}
Stat JSON type Description

compute_ops

integer

Transactional Compute Operations (TCOs) consumed by the request.

read_ops

integer

Transactional Read Operations (TROs) consumed by the request.

write_ops

integer

Transactional Write Operations (TWOs) consumed by the request.

query_time_ms

integer

Query run time in milliseconds.

contention_retries

integer

Number of times the query was retried due to transaction contention.

storage_bytes_read

integer

Amount of data, in bytes, read from storage for the request.

storage_bytes_write

integer

Amount of data, in bytes, written to storage for the request.

rate_limits_hit

array of strings

Operation types, such as compute, read, or write, that triggered a throttling error, if applicable. Requests can trigger a throttling error by exceeding plan throughput limits.

Fauna’s client drivers include query stats in a query info or query response class. This class is used for both successful query responses and errors:

Driver Query info or query response class Query stats class

JavaScript driver

Python driver

Go driver

.NET/C# driver

JVM driver

Event stats

Events returned by the Fauna Core HTTP API’s Event Feed and Event Stream endpoints include a stats object:

{
  "type": "update",
  "data": {
    ...
  },
  "txn_ts": 1711024518680000,
  "cursor": "gsGdef456",
  "stats": {
    "read_ops": 8,
    "storage_bytes_read": 208,
    "compute_ops": 1,
    "processing_time_ms": 0,
    "rate_limits_hit": []
  }
}

For stats properties, see event schema.

Event Feed page stats

The Event Feed endpoint returns pages of events. Each page includes a top-level stats object that aggregates stats for all events for the page:

{
  "events": [
    ...
  ],
  "cursor": "gsGabc456",
  "has_next": true,
  "stats": {
    "read_ops": 9,
    "storage_bytes_read": 886,
    "compute_ops": 1,
    "processing_time_ms": 8,
    "rate_limits_hit": []
  }
}
Stat JSON type Description

read_ops

integer

Transactional Read Operations (TROs) consumed by the request.

storage_bytes_read

integer

Amount of data, in bytes, read from storage for the request.

compute_ops

integer

Transactional Compute Operations (TCOs) consumed by the request.

processing_time_ms

integer

Request processing time in milliseconds.

rate_limits_hit

array of strings

Request operation types that triggered a throttling error by exceeding plan throughput limits.

Event Stream status events

The Event Stream endpoint returns a real-time stream of events.

Event Streams emit a status event when the stream starts or reconnects. Streams also periodically emit status events to:

  • Keep the client connection open.

  • Send stats on operations consumed by event processing, including discarded events that aren’t sent.

status events include stats in the stats object:

{
  "type": "status",
  "txn_ts": 1710968002310000,
  "cursor": "gsGabc123",
  "stats": {
    "read_ops": 8,
    "storage_bytes_read": 208,
    "compute_ops": 1,
    "processing_time_ms": 0,
    "rate_limits_hit": []
  }
}

For stats properties, see event schema.

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!