TypeScript SDKFeature Clients

Metrics Client

The metrics client is a client for reading metrics out of Hatchet’s metrics API.

Methods

getQueueMetrics()

Returns the queue metrics for the current tenant.

Parameters

ParameterTypeDescription
opts?RequestParamsThe options for the request.

Returns

Promise<TenantStepRunQueueMetrics>

The queue metrics for the current tenant.

getTaskStats()

Get task statistics for the tenant.

Returns

Promise<TaskStats>

A record mapping task names to their statistics.

getTaskStatusMetrics()

Returns aggregate task run counts grouped by status (queued, running, completed, failed, cancelled)

Parameters

ParameterTypeDescription
query{ additional_metadata?: string[]; parent_task_external_id?: string; since: string; triggering_event_external_id?: string; until?: string; workflow_ids?: string[]; }Filters for the metrics query (e.g. since, until, workflow_ids).
query.additional_metadata?string[]Additional metadata k-v pairs to filter by
query.parent_task_external_id?stringThe parent task's external id Format uuid Min Length 36 Max Length 36
query.since?stringThe start time to get metrics for Format date-time
query.triggering_event_external_id?stringThe id of the event that triggered the task Format uuid Min Length 36 Max Length 36
query.until?stringThe end time to get metrics for Format date-time
query.workflow_ids?string[]The workflow id to find runs for
requestParams?RequestParamsOptional request-level overrides (headers, signal, etc.).

Returns

Promise<TaskStatusMetrics>

Counts per status for the matched task runs.

scrapePrometheusMetrics()

Scrape Prometheus metrics for the tenant.

Returns

Promise<string>

The metrics in Prometheus text format.

Last updated on September 1, 2026

On this page