Skip to main content

metrics

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

Overview

Namemetrics
TypeResource
Idclickhouse.postgres.metrics

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
metricsarrayAvailable metrics, each with its bucketed time series.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectpostgres_id, from_date, to_date, organization_idbucket_size_secondsThis endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns bucketed time-series metrics for a PostgreSQL service over the requested window (CPU, memory, disk, network, connections, cache hit ratio, throughput, transactions, and more). Use this to chart or analyze how a service behaved over time.

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
from_datestring (date-time)Inclusive start of the time window (RFC 3339 date-time).
organization_idstringClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID)
postgres_idstring (uuid)ID of the Postgres service. (wire: postgresId)
to_datestring (date-time)Exclusive end of the time window (RFC 3339 date-time).
bucket_size_secondsintegerTime-series bucket size in seconds. When omitted, a bucket size is derived from the requested window. Requests are capped at 250 data points.

SELECT examples

This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns bucketed time-series metrics for a PostgreSQL service over the requested window (CPU, memory, disk, network, connections, cache hit ratio, throughput, transactions, and more). Use this to chart or analyze how a service behaved over time.

SELECT
metrics
FROM clickhouse.postgres.metrics
WHERE postgres_id = '{{ postgres_id }}' -- required
AND from_date = '{{ from_date }}' -- required
AND to_date = '{{ to_date }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
AND bucket_size_seconds = '{{ bucket_size_seconds }}'
;