Skip to content
Cloudflare Docs

Metrics

Queues expose metrics which allow you to measure the queue backlog, consumer concurrency, and message operations.

The metrics displayed in the Cloudflare dashboard are queried from Cloudflare’s GraphQL Analytics API. You can access the metrics programmatically via GraphQL or HTTP client.

Metrics

Backlog

Queues export the below metrics within the queuesBacklogAdaptiveGroups dataset.

MetricGraphQL Field NameDescription
Backlog bytesbytesAverage size of the backlog, in bytes
Backlog messagesmessagesAverage size of the backlog, in number of messages

The queuesBacklogAdaptiveGroups dataset provides the following dimensions for filtering and grouping queries:

  • queueID - ID of the queue
  • datetime - Timestamp for when the message was sent
  • date - Timestamp for when the message was sent, truncated to the start of a day
  • datetimeHour - Timestamp for when the message was sent, truncated to the start of an hour
  • datetimeMinute - Timestamp for when the message was sent, truncated to the start of a minute

Consumer concurrency

Queues export the below metrics within the queueConsumerMetricsAdaptiveGroups dataset.

MetricGraphQL Field NameDescription
Avg. Consumer ConcurrencyconcurrencyAverage number of concurrent consumers over the period

The queueConsumerMetricsAdaptiveGroups dataset provides the following dimensions for filtering and grouping queries:

  • queueID - ID of the queue
  • datetime - Timestamp for the consumer metrics
  • date - Timestamp for the consumer metrics, truncated to the start of a day
  • datetimeHour - Timestamp for the consumer metrics, truncated to the start of an hour
  • datetimeMinute - Timestamp for the consumer metrics, truncated to the start of a minute

Message operations

Queues export the below metrics within the queueMessageOperationsAdaptiveGroups dataset.

MetricGraphQL Field NameDescription
Total billable operationsbillableOperationsSum of billable operations (writes, reads, and deletes) over the time period
Total BytesbytesSum of bytes read, written, and deleted from the queue
LaglagTimeAverage lag time in milliseconds between when the message was written and the operation to consume the message.
RetriesretryCountAverage number of retries per message
Message SizemessageSizeMaximum message size over the specified period

The queueMessageOperationsAdaptiveGroups dataset provides the following dimensions for filtering and grouping queries:

  • queueID - ID of the queue
  • actionType - The type of message operation. Can be WriteMessage, ReadMessage or DeleteMessage
  • consumerType - The queue consumer type. Can be worker or http. Only applicable for ReadMessage and DeleteMessage action types
  • outcome - The outcome of the mesage operation. Only applicable for DeleteMessage action types. Can be success, dlq or fail.
  • datetime - Timestamp for the message operation
  • date - Timestamp for the message operation, truncated to the start of a day
  • datetimeHour - Timestamp for the message operation, truncated to the start of an hour
  • datetimeMinute - Timestamp for the message operation, truncated to the start of a minute

Example GraphQL Queries

Get average queue backlog over time period

query QueueBacklog($accountTag: string!, $queueId: string!, $datetimeStart: Time!, $datetimeEnd: Time!) {
viewer {
accounts(filter: {accountTag: $accountTag}) {
queueBacklogAdaptiveGroups(
limit: 10000
filter: {
queueId: $queueId
datetime_geq: $datetimeStart
datetime_leq: $datetimeEnd
}
) {
avg {
messages
bytes
}
}
}
}
}

Get average consumer concurrency by hour

query QueueConcurrencyByHour($accountTag: string!, $queueId: string!, $datetimeStart: Time!, $datetimeEnd: Time!) {
viewer {
accounts(filter: {accountTag: $accountTag}) {
queueConsumerMetricsAdaptiveGroups(
limit: 10000
filter: {
queueId: $queueId
datetime_geq: $datetimeStart
datetime_leq: $datetimeEnd
}
orderBy: [datetimeHour_DESC]
) {
avg {
concurrency
}
dimensions {
datetimeHour
}
}
}
}
}

Get message operations by minute

query QueueMessageOperationsByMinute($accountTag: string!, $queueId: string!, $datetimeStart: Date!, $datetimeEnd: Date!) {
viewer {
accounts(filter: {accountTag: $accountTag}) {
queueMessageOperationsAdaptiveGroups(
limit: 10000
filter: {
queueId: $queueId
datetime_geq: $datetimeStart
datetime_leq: $datetimeEnd
}
orderBy: [datetimeMinute_DESC]
) {
count
sum {
bytes
}
dimensions {
datetimeMinute
}
}
}
}
}