Skip to content
sproutboatDocs
Esc
↑↓navigate↵open⌘Jpreview

App metrics

Aggregates over a range: request counts by status class, outcomes, latency histograms, wakes, CPU and memory. One-minute points are kept 7 days, hourly points longer (retention in the answer says how long). totals.request_cpu and each point’s request_cpu ({hist, p50_ms, p95_ms, p99_ms, sum_ms}) are the CPU time of each request the runtime stamped one on, in the buckets of duration_bounds_ms; they are absent where no request reported a CPU time (a host from before logs step 2, a quiet minute). The per-bucket arrays have a fixed order (listed on each field); a new entry is only ever added at the end, so read them by position and ignore a longer array.

GET/v1/apps/{project}/metrics
Authorization
AuthorizationBearer token · headerrequired

A team API key, sbk_..., from Settings, API keys.

or
x-api-keyAPI key · headerrequired

The same key, in a header of its own.

Path parameters
projectstringrequired

The app's name, unique within the team. 3 to 51 characters (or 1), lowercase letters, digits and dashes, not starting or ending with a dash.

matches ^[a-z0-9](?:[a-z0-9-]{1,49}[a-z0-9])?$
Query parameters
rangestring
default: "1h"
Allowed:1h24h7d30d90d
Responses
200

The metrics.

rangestringrequired

The range asked for.

Allowed:1h24h7d30d90d
step_secondsintegerrequired

The width of one point: 60 for 1h, 600 for 24h, 3600 for 7d and 30d, 86400 for 90d.

fromstring<date-time>required
tostring<date-time>required
retentionobjectrequired
Show properties
minute_daysintegerrequired

How long one-minute points are kept (7).

hourly_daysintegerrequired

How long hourly points are kept (90).

notestringrequired
duration_bounds_msnumber[]required

Upper bounds, in milliseconds, of the buckets of every histogram here (dur, wake_dur, request_cpu.hist): 0.5, 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000. Each histogram has one more entry than this list, for everything above the last bound.

outcome_namesstring[]required

The names, in order, of the entries of outcomes: ok, exception, exceededCpu, exceededWallTime, canceled, rateLimited, suspended, unavailable, queueFull.

memory_limit_bytesinteger | nullrequired

The app's memory limit, or null while neither a host reading nor a limit in the spec is known.

pointsMetricsPoint[]required

Oldest first; a step with no data has no point.

Show properties
Array of MetricsPoint
requestsintegerrequired

Requests answered.

statusinteger[]required

Six counts in this order: no status, 1xx, 2xx, 3xx, 4xx, 5xx.

outcomesinteger[]required

Nine counts in the order of outcome_names.

durMetricsHistogramrequired

Counts per bucket of duration_bounds_ms, with a last entry for everything above the last bound (15 entries).

p50_msnumber | null

Response time quantiles from dur, linear inside the bucket; null with no requests. The overflow bucket answers its lower bound (10000).

p95_msnumber | null
p99_msnumber | null
triginteger[]required

Four counts in this order: scheduled ok, scheduled failed, other ok, other failed.

wakesintegerrequired

Times the app was started for a request or trigger.

sleepsintegerrequired

Times it was put to sleep.

cpu_usintegerrequired

CPU time of the worker process, microseconds.

oom_killsintegerrequired
crashesintegerrequired
request_cpuRequestCpu

The CPU time of each request the runtime stamped one on, in the buckets of duration_bounds_ms. Absent (the key is not there, not zero or null) where no request reported a CPU time: a host from before logs step 2, or a quiet minute. Read it as optional; an app on an old host has none.

Show properties
histMetricsHistogramrequired

Counts per bucket of duration_bounds_ms, with a last entry for everything above the last bound (15 entries).

p50_msnumber | nullrequired

CPU time per request at the median, milliseconds, from hist.

p95_msnumber | nullrequired
p99_msnumber | nullrequired
sum_msnumberrequired

Total CPU time of those requests, milliseconds; a mean is sum_ms over the sum of hist.

tstring<date-time>required

The start of the step.

dur_usintegerrequired

The summed response time, microseconds; with requests it gives the mean.

wake_durMetricsHistogramrequired

Counts per bucket of duration_bounds_ms, with a last entry for everything above the last bound (15 entries).

wake_usintegerrequired

The summed wake time, microseconds.

mem_peakinteger | nullrequired

The largest memory peak seen in the step, bytes.

mem_curinteger | nullrequired

The last memory reading in the step, bytes.

totalsMetricsTotalsrequired

The sum over the range.

Show properties
requestsintegerrequired

Requests answered.

statusinteger[]required

Six counts in this order: no status, 1xx, 2xx, 3xx, 4xx, 5xx.

outcomesinteger[]required

Nine counts in the order of outcome_names.

durMetricsHistogramrequired

Counts per bucket of duration_bounds_ms, with a last entry for everything above the last bound (15 entries).

p50_msnumber | null

Response time quantiles from dur, linear inside the bucket; null with no requests. The overflow bucket answers its lower bound (10000).

p95_msnumber | null
p99_msnumber | null
triginteger[]required

Four counts in this order: scheduled ok, scheduled failed, other ok, other failed.

wakesintegerrequired

Times the app was started for a request or trigger.

sleepsintegerrequired

Times it was put to sleep.

cpu_usintegerrequired

CPU time of the worker process, microseconds.

oom_killsintegerrequired
crashesintegerrequired
request_cpuRequestCpu

The CPU time of each request the runtime stamped one on, in the buckets of duration_bounds_ms. Absent (the key is not there, not zero or null) where no request reported a CPU time: a host from before logs step 2, or a quiet minute. Read it as optional; an app on an old host has none.

Show properties
histMetricsHistogramrequired

Counts per bucket of duration_bounds_ms, with a last entry for everything above the last bound (15 entries).

p50_msnumber | nullrequired

CPU time per request at the median, milliseconds, from hist.

p95_msnumber | nullrequired
p99_msnumber | nullrequired
sum_msnumberrequired

Total CPU time of those requests, milliseconds; a mean is sum_ms over the sum of hist.

errors_5xxintegerrequired

status[5].

mem_peakinteger | nullrequired

The largest memory peak in the range, bytes.

400

The request is malformed. path names the field when one is at fault; some refusals (a digest mismatch, a body that is not JSON) carry a message only.

One of:
ErrorInvalid
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:invalid
ErrorPlain
errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
401

No key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
403

The key lacks a grant (reason: forbidden, need: "<resource>:<action>").

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:forbidden
needstringrequired

The grant, as <resource>:<action>, for example app:write.

404

No such app, build, secret, manifest or claim in this team (another team's resource looks the same).

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
429

The key is over its requests a minute (600, or 2,000 with app:write; reason: key-rate-limited, retry_after_s, Retry-After). Wait that long and retry.

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:key-rate-limited
retry_after_sintegerrequired

Seconds to wait; also the Retry-After header.

Request
curl -X GET 'https://dash.sproutboat.com/v1/apps/my-app/metrics' \
  -H 'Authorization: Bearer YOUR_TOKEN'
Response
{
  "range": "1h",
  "step_seconds": 0,
  "from": "2019-08-24T14:15:22Z",
  "to": "2019-08-24T14:15:22Z",
  "retention": {
    "minute_days": 0,
    "hourly_days": 0,
    "note": "string"
  },
  "duration_bounds_ms": [
    0
  ],
  "outcome_names": [
    "string"
  ],
  "memory_limit_bytes": 0,
  "points": [
    {
      "requests": 0,
      "status": [
        0
      ],
      "outcomes": [
        0
      ],
      "dur": [
        0
      ],
      "p50_ms": 0,
      "p95_ms": 0,
      "p99_ms": 0,
      "trig": [
        0
      ],
      "wakes": 0,
      "sleeps": 0,
      "cpu_us": 0,
      "oom_kills": 0,
      "crashes": 0,
      "request_cpu": {
        "hist": [
          0
        ],
        "p50_ms": 0,
        "p95_ms": 0,
        "p99_ms": 0,
        "sum_ms": 0
      },
      "t": "2019-08-24T14:15:22Z",
      "dur_us": 0,
      "wake_dur": [
        0
      ],
      "wake_us": 0,
      "mem_peak": 0,
      "mem_cur": 0
    }
  ],
  "totals": {
    "requests": 0,
    "status": [
      0
    ],
    "outcomes": [
      0
    ],
    "dur": [
      0
    ],
    "p50_ms": 0,
    "p95_ms": 0,
    "p99_ms": 0,
    "trig": [
      0
    ],
    "wakes": 0,
    "sleeps": 0,
    "cpu_us": 0,
    "oom_kills": 0,
    "crashes": 0,
    "request_cpu": {
      "hist": [
        0
      ],
      "p50_ms": 0,
      "p95_ms": 0,
      "p99_ms": 0,
      "sum_ms": 0
    },
    "errors_5xx": 0,
    "mem_peak": 0
  }
}