Skip to content

Endpoint: Performance Monitoring ​

Real-time system health metrics across application, database, AI providers, and gateway layers. Use this endpoint to build dashboards, trigger operational alerts, and diagnose performance bottlenecks.

Authentication ​

Requires session-based authentication with the SUPER_ADMIN role. All other roles receive 403 Super Admin required.


GET /api/admin/performance-meter ​

Collect aggregated health metrics from all system components in a single request. Each metric is represented as a MeterZone object with a status indicator, current value, and actionable recommendation when thresholds are breached.

Example Request ​

bash
curl https://app.veriprompt.tech/api/admin/performance-meter \
  -H "Authorization: Bearer YOUR_API_KEY"

Success Response ​

json
{
  "success": true,
  "timestamp": "2026-03-24T10:15:00.000Z",
  "overallStatus": "warning",
  "summary": {
    "total": 9,
    "healthy": 7,
    "warning": 1,
    "critical": 0,
    "unknown": 1
  },
  "meters": [
    {
      "id": "app-memory",
      "label": "App Memory (Heap)",
      "category": "application",
      "status": "healthy",
      "value": 62,
      "unit": "%",
      "details": "145MB / 234MB heap — RSS 312MB",
      "action": null,
      "thresholds": { "warning": 75, "critical": 90 }
    },
    {
      "id": "app-uptime",
      "label": "Uptime",
      "category": "application",
      "status": "healthy",
      "value": 72.3,
      "unit": "hours",
      "details": "Process running for 72.3h",
      "action": null
    },
    {
      "id": "db-latency",
      "label": "Database Latency",
      "category": "database",
      "status": "healthy",
      "value": 12,
      "unit": "ms",
      "details": "Simple query: 12ms",
      "action": null,
      "thresholds": { "warning": 100, "critical": 500 }
    },
    {
      "id": "db-cache",
      "label": "DB Cache Hit Ratio",
      "category": "database",
      "status": "healthy",
      "value": 99.12,
      "unit": "%",
      "details": "99.12% of queries served from cache",
      "action": null,
      "thresholds": { "warning": 95, "critical": 90 }
    },
    {
      "id": "db-connections",
      "label": "Active DB Connections",
      "category": "database",
      "status": "healthy",
      "value": 8,
      "unit": "connections",
      "details": "8 active connections to database",
      "action": null,
      "thresholds": { "warning": 40, "critical": 80 }
    },
    {
      "id": "db-size",
      "label": "Database Size",
      "category": "database",
      "status": "healthy",
      "value": 256,
      "unit": "MB",
      "details": "Total database size: 256MB",
      "action": null,
      "thresholds": { "warning": 4000, "critical": 8000 }
    },
    {
      "id": "provider-trust",
      "label": "Avg Provider Trust Score",
      "category": "providers",
      "status": "warning",
      "value": 68,
      "unit": "/100",
      "details": "3 active provider(s) — average trust score 68/100",
      "action": "Provider quality degraded — check individual provider health and consider routing adjustments.",
      "thresholds": { "warning": 70, "critical": 50 }
    },
    {
      "id": "provider-count",
      "label": "Active Providers",
      "category": "providers",
      "status": "healthy",
      "value": 3,
      "unit": "providers",
      "details": "3 AI provider(s) configured and active",
      "action": null
    },
    {
      "id": "gw-executions-24h",
      "label": "Gateway Executions (24h)",
      "category": "gateway",
      "status": "healthy",
      "value": 1847,
      "unit": "requests",
      "details": "1847 requests in last 24h — 42310 total all-time",
      "action": null
    }
  ],
  "actionItems": [
    {
      "meterId": "provider-trust",
      "category": "providers",
      "label": "Avg Provider Trust Score",
      "severity": "warning",
      "action": "Provider quality degraded — check individual provider health and consider routing adjustments."
    }
  ]
}

MeterZone Object ​

Each item in the meters array follows this structure:

FieldTypeDescription
idstringUnique meter identifier (e.g., app-memory, db-latency)
labelstringHuman-readable meter name
categorystringOne of: application, database, providers, gateway
statusstringCurrent health: healthy, warning, critical, or unknown
valuenumber | stringCurrent metric value. String "N/A" when the metric cannot be collected.
unitstringUnit of measurement (e.g., %, ms, connections, providers, requests)
detailsstringHuman-readable description of the current state
actionstring | nullRecommended remediation when status is warning or critical. Null when healthy.
thresholdsobject | undefinedOptional { warning: number, critical: number } defining the boundary values

Metric Categories ​

Application ​

MeterWhat It MeasuresThresholds
app-memoryV8 heap usage as a percentage of total heapWarning: >75%, Critical: >90%
app-uptimeProcess uptime in hoursWarning: <0.1h (possible crash loop)

Database ​

MeterWhat It MeasuresThresholds
db-latencyRound-trip time for a SELECT 1 queryWarning: >100ms, Critical: >500ms
db-cachePostgreSQL buffer cache hit ratioWarning: <95%, Critical: <90%
db-connectionsActive connections to the databaseWarning: >40, Critical: >80
db-sizeTotal database size in MB or GBWarning: >4GB, Critical: >8GB

When the database is unreachable, db-latency reports value: "N/A" with status critical.

Providers ​

MeterWhat It MeasuresThresholds
provider-trustAverage trust score across all active providersWarning: <70, Critical: <50
provider-unhealthyCount of providers with trust score below 50Always critical when present
provider-countNumber of active AI providersWarning: <2 (no fallback), Critical: 0

Provider trust scores are derived from the most recent ProviderHealthSnapshot within the last 24 hours. Each provider's health snapshot tracks success rates, latency patterns, and error frequency.

Gateway ​

MeterWhat It MeasuresThresholds
gw-executions-24hPrompt executions through the gateway in the last 24 hoursInformational (always healthy)

Circuit Breaker States ​

Provider health monitoring uses a circuit breaker pattern to protect the system from cascading failures:

StateDescriptionBehavior
closedNormal operationAll requests routed normally to the provider
openProvider disabledNo requests sent. Triggered when error rate exceeds 50%. Automatic 5-minute cooldown before re-testing.
half-openTesting recoveryA limited number of requests are sent to check if the provider has recovered. On success, returns to closed. On failure, returns to open.

When a provider's circuit breaker opens, the routing engine automatically redirects traffic to healthy providers. The provider-unhealthy meter tracks providers currently in open or degraded state.


Overall Status ​

The overallStatus field in the response is computed from all meters:

ValueCondition
criticalOne or more meters report critical
warningNo critical meters, but one or more report warning
healthyAll meters report healthy (or unknown)

Action Items ​

The actionItems array provides a filtered list of meters that require attention, each with a concrete remediation step. Use this array to power alerting integrations or dashboard notifications without parsing the full meters array.

json
{
  "meterId": "db-latency",
  "category": "database",
  "label": "Database Latency",
  "severity": "critical",
  "action": "Latency >500ms — upgrade DB tier or check managed DB dashboard for IOPS saturation."
}

Error Responses ​

StatusBodyCause
401{ "error": "Unauthorized" }No active session
403{ "error": "Super Admin required" }User is not a Super Admin
500{ "error": "Failed to collect performance metrics" }Internal server error