Analytics

View platform-level performance metrics for your functions — request volume, error rates, CPU usage, and latency percentiles. Analytics data is aggregated across your functions and cached for 5 minutes.

Get analytics

curl "https://api.fold.run/analytics/7" \
  -H "Authorization: Bearer YOUR_TOKEN"

The path segment is the number of days to query (default 7, max 30). Your organization is identified from the auth token.

Response:

{
  "tenant_id": "my-tenant",
  "days": 7,
  "totals": {
    "requests": 12450,
    "errors": 23,
    "error_rate": 0.18,
    "cpu_time_p50": 4,
    "cpu_time_p99": 45,
    "wall_time": 892000
  },
  "daily": [
    {
      "scriptName": "my-tenant_my-api",
      "datetime": "2026-03-14T00:00:00Z",
      "requests": 1832,
      "errors": 3,
      "wallTime": 127000,
      "cpuTimeP50": 3,
      "cpuTimeP99": 42
    }
  ]
}

Metrics reference

Totals

Field Description
requests Total request count for the period
errors Total error count (non-2xx responses)
error_rate Error percentage (0-100)
cpu_time_p50 Median CPU time per request (milliseconds)
cpu_time_p99 99th percentile CPU time (milliseconds)
wall_time Total wall-clock execution time (milliseconds)

Daily breakdown

Each entry in the daily array represents one day of metrics per function, including the script name (format: {tenant}_{function}), request and error counts, wall time, and CPU percentiles.

Function metrics

For per-function analytics with invocation counts, error rates, latency, and daily breakdowns, use the function metrics endpoint:

curl "https://api.fold.run/functions/metrics?days=7" \
  -H "Authorization: Bearer YOUR_TOKEN"

Returns metrics for all functions in your organization:

{
  "metrics": [
    {
      "function_id": "fn_abc",
      "function_name": "my-api",
      "invocations": 5200,
      "errors": 12,
      "error_rate": 0.23,
      "avg_duration_ms": 45,
      "p95_duration_ms": 120,
      "trend": "up",
      "daily": [
        { "date": "2026-03-14", "invocations": 800, "errors": 2, "avg_duration_ms": 42 }
      ]
    }
  ],
  "days": 7
}

Dashboard

View analytics in the dashboard:

Both pages support configurable time ranges (7, 14, 30, 60, or 90 days).

Caching

Analytics results are cached for 5 minutes per organization to keep data reasonably fresh without excessive recomputation.