Skip to main content

work_stats

Creates, updates, deletes, gets or lists a work_stats resource.

Overview​

Namework_stats
TypeResource
Idanthropic.environments.work_stats

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
depthintegerNumber of work items waiting to be picked up (lag from consumer group)
oldest_queued_atstringRFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty
pendingintegerNumber of work items being processed (polled but not acknowledged)
typestringThe type of object (work_queue_stats)
workers_pollingintegerNumber of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectenvironment_idanthropic-workspace-idGet statistics about the work queue for an environment.

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
environment_idstring (example: env_011CZkZ9X2dpNyB7HsEFoRfW)
anthropic-workspace-idstringOptional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy). Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace. (example: wrkspc_011CZkZaBF1tNoB5wlCeusgy)

SELECT examples​

Get statistics about the work queue for an environment.

SELECT
depth,
oldest_queued_at,
pending,
type,
workers_polling
FROM anthropic.environments.work_stats
WHERE environment_id = '{{ environment_id }}' -- required
AND "anthropic-workspace-id" = '{{ anthropic-workspace-id }}'
;