metrics
Creates, updates, deletes, gets or lists a metrics resource.
Overview
| Name | metrics |
| Type | Resource |
| Id | clickhouse.postgres.metrics |
Fields
The following fields are returned by SELECT queries:
- get
| Name | Datatype | Description |
|---|---|---|
metrics | array | Available metrics, each with its bucketed time series. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | postgres_id, from_date, to_date, organization_id | bucket_size_seconds | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
from_date | string (date-time) | Inclusive start of the time window (RFC 3339 date-time). |
organization_id | string | ClickHouse 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_id | string (uuid) | ID of the Postgres service. (wire: postgresId) |
to_date | string (date-time) | Exclusive end of the time window (RFC 3339 date-time). |
bucket_size_seconds | integer | Time-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
- get
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 }}'
;