---
title: "Metrics history: size, connections, operations per second, cache hit ratio and memory (samples for 24h, hourly for 7d/30d/90d)"
method: GET
path: "/databases/{databaseId}/metrics"
tags: ["Databases"]
---

# Metrics history: size, connections, operations per second, cache hit ratio and memory (samples for 24h, hourly for 7d/30d/90d)

`GET /databases/{databaseId}/metrics`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/databases/{databaseId}/metrics`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `databaseId` string, uuid, required

## Query parameters

- `range` '24h' | '7d' | '30d' | '90d'

## Response `200`

Metrics

- object
  - `databaseId` string, uuid, required
  - `engine` 'postgresql' | 'mysql' | 'mariadb' | 'redis' | 'mongodb', required
  - `range` '24h' | '7d' | '30d' | '90d', required
  - `resolution` '5m' | '1h', required: 24h: every sample; 7d/30d/90d: hourly
  - `intervalSeconds` integer, required: how often samples are collected
  - `collecting` boolean, required: metrics are collected on this server
  - `status` string, required: database status
  - `opsUnit` 'transactions' | 'queries' | 'operations' | 'commands', required
  - `cacheKind` 'buffer_cache' | 'buffer_pool' | 'wiredtiger_cache' | 'keyspace', required
  - `lastSampleAt` string, nullable, required: ISO-8601 timestamp
  - `lastError` string, nullable, required: why the last collection for this team failed, if it did
  - `latest` object, nullable, required
    - `at` string, required: sample time (24h) or the start of the hour (7d/30d/90d)
    - `sizeBytes` number, nullable, required: largest data size in the bucket
    - `connections` number, nullable, required: open client connections (hourly: average)
    - `connectionsMax` number, nullable, required
    - `maxConnections` number, nullable, required: the server's connection limit
    - `memoryBytes` number, nullable, required: server memory in use (MongoDB resident, Redis RSS); null for PostgreSQL/MySQL
    - `opsPerSec` number, nullable, required: transactions (PostgreSQL), queries (MySQL/MariaDB), operations (MongoDB) or commands (Redis) per second
    - `opsPerSecMax` number, nullable, required
    - `cacheHitRatio` number, nullable, required: 0-1: share of reads served from memory (buffer cache, InnoDB buffer pool, WiredTiger cache, Redis keyspace hits)
  - `points` object[], required
    - `at` string, required: sample time (24h) or the start of the hour (7d/30d/90d)
    - `sizeBytes` number, nullable, required: largest data size in the bucket
    - `connections` number, nullable, required: open client connections (hourly: average)
    - `connectionsMax` number, nullable, required
    - `maxConnections` number, nullable, required: the server's connection limit
    - `memoryBytes` number, nullable, required: server memory in use (MongoDB resident, Redis RSS); null for PostgreSQL/MySQL
    - `opsPerSec` number, nullable, required: transactions (PostgreSQL), queries (MySQL/MariaDB), operations (MongoDB) or commands (Redis) per second
    - `opsPerSecMax` number, nullable, required
    - `cacheHitRatio` number, nullable, required: 0-1: share of reads served from memory (buffer cache, InnoDB buffer pool, WiredTiger cache, Redis keyspace hits)

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Not permitted (code forbidden); details.sessionRequired: the console needs a dashboard session
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Conflicting state (code conflict): details.preparing (the console is connecting, retry after details.retryAfterSeconds), details.busy (a statement is running), details.ended (open a new session), details.reason console_limit
- `429`: Too many requests (code rate_limited); see Retry-After
- `501`: Not available on this server (code not_configured)
- `503`: The console did not answer in time (code provider_unavailable)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
