CapyDB Docs
ReferenceAPI

Observability

Live database metrics for a project.

GET
/v1/projects/{projectID}/observability

Authorization

AuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

In: header

Path Parameters

projectID*string

Project id.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/string/observability"
{  "observability": {    "active_queries": [      {        "duration_ms": 0,        "pid": 0,        "query": "string",        "state": "string",        "username": "string",        "wait_event": "string",        "wait_event_type": "string"      }    ],    "alerts": [      "string"    ],    "connection_count": 0,    "connection_limit": 0,    "connection_usage_percent": 0,    "database_size_bytes": 0,    "pg_stat_statements": true,    "slow_queries": [      {        "calls": 0,        "mean_time_ms": 0,        "query": "string",        "rows": 0,        "total_time_ms": 0      }    ],    "storage_limit_bytes": 0,    "storage_usage_percent": 0  }}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
GET
/v1/projects/{projectID}/observability/history

Authorization

AuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

In: header

Path Parameters

projectID*string

Project id.

Query Parameters

hours?integer

Trailing window in hours, between 1 and 720 (default 24).

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/string/observability/history"
{  "samples": [    {      "active_queries": 0,      "avg_query_ms": 0,      "blocked_queries": 0,      "cache_hit_ratio": 0,      "connection_limit": 0,      "connections": 0,      "dead_tuples": 0,      "deadlocks": 0,      "rollback_ratio": 0,      "rows_read_per_sec": 0,      "rows_written_per_sec": 0,      "sampled_at": "2019-08-24T14:15:22Z",      "slow_queries": 0,      "storage_bytes": 0,      "storage_limit_bytes": 0,      "temp_bytes": 0,      "tps": 0    }  ]}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
GET
/v1/projects/{projectID}/observability/queries

Authorization

AuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

In: header

Path Parameters

projectID*string

Project id.

Query Parameters

hours?integer

Trailing window in hours, between 1 and 168 (default 24).

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/string/observability/queries"
{  "queries": [    {      "calls": 0,      "mean_exec_ms": 0,      "query": "string",      "rows": 0,      "total_exec_ms": 0    }  ]}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
GET
/v1/projects/{projectID}/alerts

Authorization

AuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

In: header

Path Parameters

projectID*string

Project id.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/string/alerts"
{  "alerts": [    {      "acknowledged_at": "2019-08-24T14:15:22Z",      "id": "string",      "kind": "storage",      "last_notified_at": "2019-08-24T14:15:22Z",      "limit_value": 0,      "observed_value": 0,      "project_id": "string",      "resolved_at": "2019-08-24T14:15:22Z",      "severity": "warning",      "triggered_at": "2019-08-24T14:15:22Z"    }  ]}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
POST
/v1/projects/{projectID}/alerts/{alertID}/acknowledge

Authorization

AuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

In: header

Path Parameters

projectID*string

Project id.

alertID*string

Project alert identifier.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/string/alerts/string/acknowledge"
{  "alert": {    "acknowledged_at": "2019-08-24T14:15:22Z",    "id": "string",    "kind": "storage",    "last_notified_at": "2019-08-24T14:15:22Z",    "limit_value": 0,    "observed_value": 0,    "project_id": "string",    "resolved_at": "2019-08-24T14:15:22Z",    "severity": "warning",    "triggered_at": "2019-08-24T14:15:22Z"  }}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}