From c508d4617cbe57ff2bbeec548cc011b1a00b6ec9 Mon Sep 17 00:00:00 2001 From: Cory O'Daniel Date: Mon, 30 Nov 2026 12:30:56 -0800 Subject: [PATCH 1/2] Document md/v2/health for the status dot Co-Authored-By: Claude Opus 5.5 --- .../automations/19-statuspage.md | 9 +++-- docs/guides/annotations/03-widgets.mdx | 40 ++++++++++++++----- docs/guides/annotations/04-metadata.mdx | 2 +- docs/guides/dashboard/02-tour.md | 4 +- docs/guides/dashboard/03-reading-the-map.md | 2 +- .../dashboard/04-stash-and-annotations.md | 7 ++-- docs/guides/stash/01-overview.md | 4 +- docs/guides/stash/02-well-known-keys.mdx | 39 +++++++++++++++++- docs/guides/stash/06-provisioners.md | 4 +- src/components/Annotations/index.js | 4 +- 10 files changed, 87 insertions(+), 28 deletions(-) diff --git a/docs/continuous-delivery/automations/19-statuspage.md b/docs/continuous-delivery/automations/19-statuspage.md index 7f1be533..6b2f036b 100644 --- a/docs/continuous-delivery/automations/19-statuspage.md +++ b/docs/continuous-delivery/automations/19-statuspage.md @@ -49,10 +49,11 @@ An incident opens when a row becomes degraded or worse, and resolves when the ro ## Stash -[stash-sync](https://github.com/massdriver-cloud/massdriver-automations/tree/main/automations/stash-sync) and other tools write live state to the [`md/v1/` keys](/guides/stash/well-known-keys). statuspage reads two of them: +[stash-sync](https://github.com/massdriver-cloud/massdriver-automations/tree/main/automations/stash-sync) and other tools write live state to the [`md/v1/` keys](/guides/stash/well-known-keys). statuspage reads three of them: | Key | Scope | On the page | |---|---|---| +| `md/v2/health` | instance | A `red` color shows the impact of the instance, or major outage. `amber` shows degraded performance. Any other color adds nothing. Without a color, the `state` counts as in `md/v1/health`. | | `md/v1/health` | instance | `healthy`, `ok`, and `up` add nothing. `degraded`, `warning`, and `recovering` show degraded performance. `down`, `failed`, and `error` show the impact of the instance, or major outage. | | `md/v1/banner` | environment | A notice with the environment title, on every page that has the environment. `info` and `warning` show as those levels, and `error` as critical. A banner changes no status. | @@ -102,7 +103,7 @@ pages: | `attributes.title` | `status_title` | The attribute that sets the row title of an instance. | | `attributes.hidden` | `status_hidden` | The attribute that hides an instance when its value is `true`. | | `attributes.impact` | `status_impact` | The attribute that sets the impact of the alarms of an instance. | -| `stash.health` | `false` | Reads `md/v1/health` of each instance. | +| `stash.health` | `false` | Reads `md/v2/health` and `md/v1/health` of each instance. | | `stash.banners` | `false` | Shows `md/v1/banner` of each environment as a notice. | | `stash.min_level` | `info` | The lowest banner level that shows: `info`, `warning`, or `error`. | | `announcements` | | Banners: `message`, `level` (`info`, `warning`, `critical`), `url`, `pages` (slugs), `starts_at`, `ends_at`. | @@ -194,7 +195,7 @@ mass event destination create \ --condition '(.data.attributes["md-project"] + "-" + .data.attributes["md-environment"]) as $env | ($env | IN("api-prod", "web-prod", "api-staging")) and (.data.metadata.deployment_action // "PROVISION") != "PLAN" - and ((.type | startswith("stash_entry.") | not) or (.data.entity.key | IN("md/v1/health", "md/v1/banner")))' + and ((.type | startswith("stash_entry.") | not) or (.data.entity.key | IN("md/v2/health", "md/v1/health", "md/v1/banner")))' ``` List the environment identifiers of your config in `IN(...)`. When every environment is in one project, also add `--attribute md-project=`. Leave out the two `stash_entry` types when `stash` is off. The last line drops the other stash keys, such as `md/v1/usage`, which stash-sync writes every interval. @@ -225,5 +226,5 @@ The image runs as user `65532`. That user must be able to write to `STATE_DIR` a - Attributes are set on projects, environments, and components, not on single instances. Each custom attribute has a fixed list of values, so declare each `status_title` value on the attribute first. - Massdriver has no event for the end of an environment deployment. Each instance deployment is shown on its own. - A deployment shows as maintenance only while it runs. Queued and proposed deployments do not. -- The page does not read `md/v1/traffic`. A high error rate shows only through an alarm or `md/v1/health`. +- The page does not read `md/v1/traffic`. A high error rate shows only through an alarm or the health. - `output_dir` does not delete files of a page that you remove from the config. diff --git a/docs/guides/annotations/03-widgets.mdx b/docs/guides/annotations/03-widgets.mdx index 5277976c..a5b8ce0f 100644 --- a/docs/guides/annotations/03-widgets.mdx +++ b/docs/guides/annotations/03-widgets.mdx @@ -35,6 +35,7 @@ To hide automatic widgets, click the **Widgets** button in the canvas toolbar, a | Key | Set on | Format | Widget | Add by hand | |---|---|---|---|---| +| `md/v2/health` | Instance | JSON | [Status dot](#status-dot) | yes | | `md/v1/health` | Instance | TEXT | [Status dot](#status-dot) | yes | | `md/v1/usage` | Instance | JSON | [Usage bar](#usage-bar) | yes | | `md/v1/traffic` | Instance | JSON | [Traffic](#traffic) on the lines that leave the instance | yes | @@ -56,11 +57,19 @@ The `md/` prefix is reserved. The server checks each write to an `md/` key. See A colored dot in the header of an instance node. The tooltip shows the label and the value, for example `Health: degraded`. -### Automatic: `md/v1/health` +### Automatic: `md/v2/health` -Set on the instance. Format: TEXT. +Set on the instance. Format: JSON. + +The value must match the [`md/v2/health` schema](/guides/stash/well-known-keys#mdv2health). `state` is the word shown with the dot. `color` is optional. + +```bash +mass alpha stash set billing-dev-app.md/v2/health '{"state": "Rolling out", "color": "blue"}' --format json +``` + +When an instance has both `md/v2/health` and `md/v1/health`, the dot shows `md/v2/health`. -The value must match the [`md/v1/health` schema](/guides/stash/well-known-keys#mdv1health). +`md/v1/health` still works. Its value is the state as TEXT, and the state sets the color: ```bash mass alpha stash set billing-dev-app.md/v1/health degraded @@ -68,12 +77,24 @@ mass alpha stash set billing-dev-app.md/v1/health degraded ### What it looks like -| State | Looks like | Value | Meaning | -|---|---|---|---| -| Healthy | | `healthy`, `ok`, or `up` | A green dot. | -| Degraded | | `degraded`, `warning`, or `recovering` | An amber dot. | -| Down | | `down`, `failed`, or `error` | A red dot. | -| Unknown | | any other text | A gray dot. | +| Color | Looks like | +|---|---| +| `green` | | +| `amber` | | +| `red` | | +| `blue` | | +| `purple` | | +| `gray` | | +| A hex color, such as `#7C3AED` | | + +Without a color, the state sets the color: + +| State | Color | +|---|---| +| `healthy`, `ok`, or `up` | Green | +| `degraded`, `warning`, or `recovering` | Amber | +| `down`, `failed`, or `error` | Red | +| any other text | Gray | The match ignores case and spaces at each end. @@ -84,6 +105,7 @@ Right-click an instance node and choose **Add widget** > **Status dot**. | Input | Type | Required | Example key | Path | |---|---|---|---|---| | `state` | string | yes | `status/health` on the instance (TEXT) | none | +| `color` | string | no | `status/color` on the instance (TEXT) | none | ## Usage bar diff --git a/docs/guides/annotations/04-metadata.mdx b/docs/guides/annotations/04-metadata.mdx index 94e3f285..8965200d 100644 --- a/docs/guides/annotations/04-metadata.mdx +++ b/docs/guides/annotations/04-metadata.mdx @@ -52,7 +52,7 @@ The instance Signals tab shows the instance's automatic widgets above the entrie | Stat | Key | Value | |---|---|---| -| Health | `md/v1/health` | A colored dot and the value | +| Health | `md/v2/health` or `md/v1/health` | A colored dot and the state | | Traffic | `md/v1/traffic` | A colored dot and the traffic label for the lines that leave the instance, such as `240 rps ยท 180 ms`. It says "stale" when the data is more than 10 minutes old. | | Usage | `md/v1/usage` | The usage bar and the numbers, such as `37 / 100` | diff --git a/docs/guides/dashboard/02-tour.md b/docs/guides/dashboard/02-tour.md index 89f2ec81..ef99f3b2 100644 --- a/docs/guides/dashboard/02-tour.md +++ b/docs/guides/dashboard/02-tour.md @@ -117,7 +117,7 @@ Massdriver Constellation streams the stash, so each key shows the moment it is s Open a second terminal and set a few [well-known keys](/guides/stash/well-known-keys): ```bash -mass alpha stash set billing-dev-app.md/v1/health degraded +mass alpha stash set billing-dev-app.md/v2/health '{"state": "degraded"}' --format json ``` `billing-dev` ripples and a ๐Ÿฉบ rises out of it. The ticker draws the change the way the widget looks, without the key: `๐Ÿฉบ Billing / Development ยท โ— degraded`, with the dot in amber. In the side panel, the instance's dot turns amber too. Start with `--flashes words` to see the event's name in both places instead of the emoji. @@ -158,7 +158,7 @@ The bar is amber from 80% and red from 95%. A ๐Ÿ“Š rises, and the ticker draws a Set the health back when you are done: ```bash -mass alpha stash set billing-dev-app.md/v1/health healthy +mass alpha stash set billing-dev-app.md/v2/health '{"state": "healthy"}' --format json ``` See [Stash and annotations](/guides/dashboard/stash-and-annotations) for every widget, and for the notes and widgets you pin yourself. diff --git a/docs/guides/dashboard/03-reading-the-map.md b/docs/guides/dashboard/03-reading-the-map.md index bbcec74e..e9662ddf 100644 --- a/docs/guides/dashboard/03-reading-the-map.md +++ b/docs/guides/dashboard/03-reading-the-map.md @@ -55,7 +55,7 @@ Where something happens, the environment ripples and a flash rises over it. By d | ๐Ÿ‘ | A deployment was approved | | ๐Ÿ‘Ž | A deployment was rejected | | ๐Ÿšจ | An alarm fired | -| ๐Ÿฉบ | An instance's health changed (`md/v1/health`) | +| ๐Ÿฉบ | An instance's health changed (`md/v2/health` or `md/v1/health`) | | ๐Ÿ“Š | An instance's usage changed (`md/v1/usage`) | | ๐Ÿ“ˆ | An instance's traffic changed (`md/v1/traffic`) | | ๐Ÿ“ฃ | An environment's banner changed (`md/v1/banner`) | diff --git a/docs/guides/dashboard/04-stash-and-annotations.md b/docs/guides/dashboard/04-stash-and-annotations.md index 35cda861..6de217c7 100644 --- a/docs/guides/dashboard/04-stash-and-annotations.md +++ b/docs/guides/dashboard/04-stash-and-annotations.md @@ -42,7 +42,7 @@ The ticker draws the new value the way its widget looks, without the key: | Key | Flash | On the ticker | |---|---|---| -| `md/v1/health` | ๐Ÿฉบ | A dot in the health's color and the health, such as `โ— degraded` | +| `md/v2/health`, `md/v1/health` | ๐Ÿฉบ | A dot in the health's color and the state, such as `โ— degraded` | | `md/v1/usage` | ๐Ÿ“Š | A small bar and the usage, colored like the side panel's bar | | `md/v1/traffic` | ๐Ÿ“ˆ | The rate, errors, and p95 latency, such as `1.2k/s ยท โœ•12 ยท 340ms` | | `md/v1/banner` | ๐Ÿ“ฃ | `โš‘` and the message, colored by level | @@ -62,7 +62,8 @@ A [well-known key](/guides/stash/well-known-keys) draws its widget for everyone | Key | Set on | In Massdriver Constellation | |---|---|---| -| `md/v1/health` | Instance | The instance's dot, and its health in the side panel: green for `healthy`, `ok`, or `up`; amber for `degraded`, `warning`, or `recovering`; red for `down`, `failed`, or `error`; gray for anything else. A red instance blinks on the map. | +| `md/v2/health` | Instance | The instance's dot, and its state in the side panel. The dot has the `color` of the value: `green`, `amber`, `red`, `blue`, `purple`, `gray`, or a hex color such as `#7C3AED`. Without a color, the state sets the color, as in `md/v1/health`. A red instance blinks on the map. When an instance has both keys, the map shows `md/v2/health`. | +| `md/v1/health` | Instance | The instance's dot, and its health in the side panel: green for `healthy`, `ok`, or `up`; amber for `degraded`, `warning`, or `recovering`; red for `down`, `failed`, or `error`; gray for anything else. A red instance blinks on the map. This key still works. | | `md/v1/usage` | Instance | A bar under the instance in the side panel, such as `โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 82/100 connections`. Amber from 80%, red from 95%. | | `md/v1/traffic` | Instance | The links that leave the environment carry the rate, p95 latency, and errors, and the sparks follow the rate. A rate of 0 shows no sparks. | | `md/v1/banner` | Environment | A banner across the top of the map, a โš‘ next to the environment, and the message in the side panel, colored by level | @@ -71,7 +72,7 @@ A [well-known key](/guides/stash/well-known-keys) draws its widget for everyone For example: ```bash -mass alpha stash set billing-dev-app.md/v1/health degraded +mass alpha stash set billing-dev-app.md/v2/health '{"state": "Rolling out", "color": "blue"}' --format json mass alpha stash set billing-dev-app.md/v1/usage '{"value": 37, "max": 100, "label": "connections"}' --format json mass alpha stash set billing-dev-app.md/v1/traffic '{"rps": 240, "errors_5m": 2, "p95_ms": 85}' --format json mass alpha stash set billing-dev.md/v1/banner '{"message": "Deploy freeze until Friday", "level": "warning"}' --format json diff --git a/docs/guides/stash/01-overview.md b/docs/guides/stash/01-overview.md index f5d81893..1679d378 100644 --- a/docs/guides/stash/01-overview.md +++ b/docs/guides/stash/01-overview.md @@ -61,10 +61,10 @@ mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.md/v1/cost_estimate" \ ### Show live health, usage, and traffic on the canvas -Write `md/v1/health`, `md/v1/usage`, or `md/v1/traffic` on an instance. A status dot, a usage bar, or traffic on its lines shows on the canvas for everyone with `stash:view`. Set a TTL so that the widget goes away when the writer stops. +Write `md/v2/health`, `md/v1/usage`, or `md/v1/traffic` on an instance. A status dot, a usage bar, or traffic on its lines shows on the canvas for everyone with `stash:view`. Set a TTL so that the widget goes away when the writer stops. ```bash -mass alpha stash set billing-dev-app.md/v1/health degraded --ttl 600 +mass alpha stash set billing-dev-app.md/v2/health '{"state": "degraded"}' --format json --ttl 600 mass alpha stash set billing-dev-app.md/v1/traffic '{"rps": 240, "errors_5m": 2, "p95_ms": 180}' --format json --ttl 600 ``` diff --git a/docs/guides/stash/02-well-known-keys.mdx b/docs/guides/stash/02-well-known-keys.mdx index 020afbeb..9a8f8c94 100644 --- a/docs/guides/stash/02-well-known-keys.mdx +++ b/docs/guides/stash/02-well-known-keys.mdx @@ -30,6 +30,7 @@ These are the widget keys: | Key | Set on | Format | Widget name | Widget | |---|---|---|---|---| +| `md/v2/health` | Instance | JSON | `instance.status_dot` | Status dot on the instance | | `md/v1/health` | Instance | TEXT | `instance.status_dot` | Status dot on the instance | | `md/v1/usage` | Instance | JSON | `instance.usage_bar` | Usage bar on the instance | | `md/v1/traffic` | Instance | JSON | `link.traffic` | Traffic on the lines that leave the instance | @@ -56,7 +57,7 @@ These are the scorecard keys: The server rejects a write to an `md/` key when: -- No widget in the catalog reads the key. This includes a key without a version, such as `md/health`. The error names the key to use, such as `md/v1/health`. +- No widget in the catalog reads the key. This includes a key without a version, such as `md/health`. The error names the key to use, such as `md/v2/health`. - The key is set on the wrong kind of entity. - A segment of the key is not one of its allowed values. - The format is not the one in the table. @@ -73,9 +74,43 @@ Each schema has an `$id` that names its key and version, such as `https://schema The `alphaWidgetCatalog` query returns these keys, their versions, and their schemas. See [GraphQL API](/guides/stash/api#alphawidgetcatalog). +## `md/v2/health` + +Set on an instance. Format: JSON. Shows the [status dot](/guides/annotations/widgets#status-dot). + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.massdriver.cloud/stash/md/v2/health.json", + "type": "object", + "required": ["state"], + "additionalProperties": false, + "properties": { + "state": { "type": "string", "minLength": 1, "maxLength": 64 }, + "color": { + "anyOf": [ + { "enum": ["green", "amber", "red", "blue", "purple", "gray"] }, + { "type": "string", "pattern": "^#[0-9a-fA-F]{6}(?![\\s\\S])" } + ] + } + } +} +``` + +| Field | Meaning | +|---|---| +| `state` | The word shown with the dot, for example `Rolling out`. | +| `color` | Optional. The color of the dot: `green`, `amber`, `red`, `blue`, `purple`, `gray`, or a hex color with six digits, such as `#7C3AED`. | + +Without `color`, the dot has the color that [`md/v1/health`](#mdv1health) gives the state. When an instance has both keys, the dot shows `md/v2/health`. + +```bash +mass alpha stash set billing-dev-app.md/v2/health '{"state": "Rolling out", "color": "blue"}' --format json +``` + ## `md/v1/health` -Set on an instance. Format: TEXT. Shows the [status dot](/guides/annotations/widgets#status-dot). +Set on an instance. Format: TEXT. Shows the [status dot](/guides/annotations/widgets#status-dot). This key still works. Use [`md/v2/health`](#mdv2health) to set the color of the dot. ```json { diff --git a/docs/guides/stash/06-provisioners.md b/docs/guides/stash/06-provisioners.md index 5525faff..f86ec2ae 100644 --- a/docs/guides/stash/06-provisioners.md +++ b/docs/guides/stash/06-provisioners.md @@ -73,10 +73,10 @@ Do not put secrets in labels. A label is not encrypted. `--sensitive` encrypts a ## Widgets -The `md/v1/health`, `md/v1/usage`, and `md/v1/traffic` keys on the instance, and the `md/v1/banner` and `md/v1/links` keys on the environment, show [widgets](/guides/annotations/widgets) on the canvas. Health, usage, and traffic show live data. A provisioner can set a first value, for example `md/v1/health` = `healthy` after a successful apply. A metrics job, such as the [`stash-sync` automation](/guides/stash/recipes#sync-metrics-with-stash-sync), keeps the values current. +The `md/v2/health`, `md/v1/usage`, and `md/v1/traffic` keys on the instance, and the `md/v1/banner` and `md/v1/links` keys on the environment, show [widgets](/guides/annotations/widgets) on the canvas. Health, usage, and traffic show live data. A provisioner can set a first value, for example `md/v2/health` with the state `healthy` after a successful apply. A metrics job, such as the [`stash-sync` automation](/guides/stash/recipes#sync-metrics-with-stash-sync), keeps the values current. ```bash -mass alpha stash set "$MASSDRIVER_INSTANCE_ID.md/v1/health" healthy +mass alpha stash set "$MASSDRIVER_INSTANCE_ID.md/v2/health" '{"state": "healthy"}' --format json ``` ## Deployment results diff --git a/src/components/Annotations/index.js b/src/components/Annotations/index.js index d0d8c261..2216fb75 100644 --- a/src/components/Annotations/index.js +++ b/src/components/Annotations/index.js @@ -81,11 +81,11 @@ export function TrafficState({ state, label }) { ); } -export function StatusDotState({ tone, label }) { +export function StatusDotState({ tone, color, label }) { return (
- + billing-dev-app From 24f7fa8e004c04195f498e29feb30160f515281d Mon Sep 17 00:00:00 2001 From: Cory O'Daniel Date: Mon, 30 Nov 2026 15:37:09 -0800 Subject: [PATCH 2/2] Document md/v1/health as JSON with a state and a color Co-Authored-By: Claude Opus 5.5 --- .../automations/19-statuspage.md | 11 +++--- docs/guides/annotations/03-widgets.mdx | 19 +++-------- docs/guides/annotations/04-metadata.mdx | 2 +- docs/guides/dashboard/02-tour.md | 4 +-- docs/guides/dashboard/03-reading-the-map.md | 2 +- .../dashboard/04-stash-and-annotations.md | 7 ++-- docs/guides/stash/01-overview.md | 6 ++-- docs/guides/stash/02-well-known-keys.mdx | 34 ++++--------------- docs/guides/stash/06-provisioners.md | 4 +-- .../events/02-projects-environments.md | 8 ++--- .../cli/commands/mass_alpha_stash.md | 2 +- 11 files changed, 33 insertions(+), 66 deletions(-) diff --git a/docs/continuous-delivery/automations/19-statuspage.md b/docs/continuous-delivery/automations/19-statuspage.md index 6b2f036b..372f6d65 100644 --- a/docs/continuous-delivery/automations/19-statuspage.md +++ b/docs/continuous-delivery/automations/19-statuspage.md @@ -49,12 +49,11 @@ An incident opens when a row becomes degraded or worse, and resolves when the ro ## Stash -[stash-sync](https://github.com/massdriver-cloud/massdriver-automations/tree/main/automations/stash-sync) and other tools write live state to the [`md/v1/` keys](/guides/stash/well-known-keys). statuspage reads three of them: +[stash-sync](https://github.com/massdriver-cloud/massdriver-automations/tree/main/automations/stash-sync) and other tools write live state to the [`md/v1/` keys](/guides/stash/well-known-keys). statuspage reads two of them: | Key | Scope | On the page | |---|---|---| -| `md/v2/health` | instance | A `red` color shows the impact of the instance, or major outage. `amber` shows degraded performance. Any other color adds nothing. Without a color, the `state` counts as in `md/v1/health`. | -| `md/v1/health` | instance | `healthy`, `ok`, and `up` add nothing. `degraded`, `warning`, and `recovering` show degraded performance. `down`, `failed`, and `error` show the impact of the instance, or major outage. | +| `md/v1/health` | instance | A `red` color shows the impact of the instance, or major outage. `amber` shows degraded performance. Any other color adds nothing. Without a color, the `state` sets the status: `healthy`, `ok`, and `up` add nothing. `degraded`, `warning`, and `recovering` show degraded performance. `down`, `failed`, and `error` show the impact of the instance, or major outage. | | `md/v1/banner` | environment | A notice with the environment title, on every page that has the environment. `info` and `warning` show as those levels, and `error` as critical. A banner changes no status. | The stash adds to the alarms. A row takes the worse of the two, so a firing alarm still shows when the health is `healthy`. A missing, expired, or unknown health changes nothing: it is not healthy and not down. Uptime counts a stash outage as it counts an alarm. @@ -103,7 +102,7 @@ pages: | `attributes.title` | `status_title` | The attribute that sets the row title of an instance. | | `attributes.hidden` | `status_hidden` | The attribute that hides an instance when its value is `true`. | | `attributes.impact` | `status_impact` | The attribute that sets the impact of the alarms of an instance. | -| `stash.health` | `false` | Reads `md/v2/health` and `md/v1/health` of each instance. | +| `stash.health` | `false` | Reads `md/v1/health` of each instance. | | `stash.banners` | `false` | Shows `md/v1/banner` of each environment as a notice. | | `stash.min_level` | `info` | The lowest banner level that shows: `info`, `warning`, or `error`. | | `announcements` | | Banners: `message`, `level` (`info`, `warning`, `critical`), `url`, `pages` (slugs), `starts_at`, `ends_at`. | @@ -195,7 +194,7 @@ mass event destination create \ --condition '(.data.attributes["md-project"] + "-" + .data.attributes["md-environment"]) as $env | ($env | IN("api-prod", "web-prod", "api-staging")) and (.data.metadata.deployment_action // "PROVISION") != "PLAN" - and ((.type | startswith("stash_entry.") | not) or (.data.entity.key | IN("md/v2/health", "md/v1/health", "md/v1/banner")))' + and ((.type | startswith("stash_entry.") | not) or (.data.entity.key | IN("md/v1/health", "md/v1/banner")))' ``` List the environment identifiers of your config in `IN(...)`. When every environment is in one project, also add `--attribute md-project=`. Leave out the two `stash_entry` types when `stash` is off. The last line drops the other stash keys, such as `md/v1/usage`, which stash-sync writes every interval. @@ -226,5 +225,5 @@ The image runs as user `65532`. That user must be able to write to `STATE_DIR` a - Attributes are set on projects, environments, and components, not on single instances. Each custom attribute has a fixed list of values, so declare each `status_title` value on the attribute first. - Massdriver has no event for the end of an environment deployment. Each instance deployment is shown on its own. - A deployment shows as maintenance only while it runs. Queued and proposed deployments do not. -- The page does not read `md/v1/traffic`. A high error rate shows only through an alarm or the health. +- The page does not read `md/v1/traffic`. A high error rate shows only through an alarm or `md/v1/health`. - `output_dir` does not delete files of a page that you remove from the config. diff --git a/docs/guides/annotations/03-widgets.mdx b/docs/guides/annotations/03-widgets.mdx index a5b8ce0f..4f3be325 100644 --- a/docs/guides/annotations/03-widgets.mdx +++ b/docs/guides/annotations/03-widgets.mdx @@ -35,8 +35,7 @@ To hide automatic widgets, click the **Widgets** button in the canvas toolbar, a | Key | Set on | Format | Widget | Add by hand | |---|---|---|---|---| -| `md/v2/health` | Instance | JSON | [Status dot](#status-dot) | yes | -| `md/v1/health` | Instance | TEXT | [Status dot](#status-dot) | yes | +| `md/v1/health` | Instance | JSON | [Status dot](#status-dot) | yes | | `md/v1/usage` | Instance | JSON | [Usage bar](#usage-bar) | yes | | `md/v1/traffic` | Instance | JSON | [Traffic](#traffic) on the lines that leave the instance | yes | | `md/v1/banner` | Environment | JSON | [Banner](#banner) | yes | @@ -57,22 +56,14 @@ The `md/` prefix is reserved. The server checks each write to an `md/` key. See A colored dot in the header of an instance node. The tooltip shows the label and the value, for example `Health: degraded`. -### Automatic: `md/v2/health` +### Automatic: `md/v1/health` Set on the instance. Format: JSON. -The value must match the [`md/v2/health` schema](/guides/stash/well-known-keys#mdv2health). `state` is the word shown with the dot. `color` is optional. +The value must match the [`md/v1/health` schema](/guides/stash/well-known-keys#mdv1health). `state` is the word shown with the dot. `color` is optional. ```bash -mass alpha stash set billing-dev-app.md/v2/health '{"state": "Rolling out", "color": "blue"}' --format json -``` - -When an instance has both `md/v2/health` and `md/v1/health`, the dot shows `md/v2/health`. - -`md/v1/health` still works. Its value is the state as TEXT, and the state sets the color: - -```bash -mass alpha stash set billing-dev-app.md/v1/health degraded +mass alpha stash set billing-dev-app.md/v1/health '{"state": "Rolling out", "color": "blue"}' --format json ``` ### What it looks like @@ -94,7 +85,7 @@ Without a color, the state sets the color: | `healthy`, `ok`, or `up` | Green | | `degraded`, `warning`, or `recovering` | Amber | | `down`, `failed`, or `error` | Red | -| any other text | Gray | +| any other state | Gray | The match ignores case and spaces at each end. diff --git a/docs/guides/annotations/04-metadata.mdx b/docs/guides/annotations/04-metadata.mdx index 8965200d..12b48e5e 100644 --- a/docs/guides/annotations/04-metadata.mdx +++ b/docs/guides/annotations/04-metadata.mdx @@ -52,7 +52,7 @@ The instance Signals tab shows the instance's automatic widgets above the entrie | Stat | Key | Value | |---|---|---| -| Health | `md/v2/health` or `md/v1/health` | A colored dot and the state | +| Health | `md/v1/health` | A colored dot and the state | | Traffic | `md/v1/traffic` | A colored dot and the traffic label for the lines that leave the instance, such as `240 rps ยท 180 ms`. It says "stale" when the data is more than 10 minutes old. | | Usage | `md/v1/usage` | The usage bar and the numbers, such as `37 / 100` | diff --git a/docs/guides/dashboard/02-tour.md b/docs/guides/dashboard/02-tour.md index ef99f3b2..af8cca2d 100644 --- a/docs/guides/dashboard/02-tour.md +++ b/docs/guides/dashboard/02-tour.md @@ -117,7 +117,7 @@ Massdriver Constellation streams the stash, so each key shows the moment it is s Open a second terminal and set a few [well-known keys](/guides/stash/well-known-keys): ```bash -mass alpha stash set billing-dev-app.md/v2/health '{"state": "degraded"}' --format json +mass alpha stash set billing-dev-app.md/v1/health '{"state": "degraded"}' --format json ``` `billing-dev` ripples and a ๐Ÿฉบ rises out of it. The ticker draws the change the way the widget looks, without the key: `๐Ÿฉบ Billing / Development ยท โ— degraded`, with the dot in amber. In the side panel, the instance's dot turns amber too. Start with `--flashes words` to see the event's name in both places instead of the emoji. @@ -158,7 +158,7 @@ The bar is amber from 80% and red from 95%. A ๐Ÿ“Š rises, and the ticker draws a Set the health back when you are done: ```bash -mass alpha stash set billing-dev-app.md/v2/health '{"state": "healthy"}' --format json +mass alpha stash set billing-dev-app.md/v1/health '{"state": "healthy"}' --format json ``` See [Stash and annotations](/guides/dashboard/stash-and-annotations) for every widget, and for the notes and widgets you pin yourself. diff --git a/docs/guides/dashboard/03-reading-the-map.md b/docs/guides/dashboard/03-reading-the-map.md index e9662ddf..bbcec74e 100644 --- a/docs/guides/dashboard/03-reading-the-map.md +++ b/docs/guides/dashboard/03-reading-the-map.md @@ -55,7 +55,7 @@ Where something happens, the environment ripples and a flash rises over it. By d | ๐Ÿ‘ | A deployment was approved | | ๐Ÿ‘Ž | A deployment was rejected | | ๐Ÿšจ | An alarm fired | -| ๐Ÿฉบ | An instance's health changed (`md/v2/health` or `md/v1/health`) | +| ๐Ÿฉบ | An instance's health changed (`md/v1/health`) | | ๐Ÿ“Š | An instance's usage changed (`md/v1/usage`) | | ๐Ÿ“ˆ | An instance's traffic changed (`md/v1/traffic`) | | ๐Ÿ“ฃ | An environment's banner changed (`md/v1/banner`) | diff --git a/docs/guides/dashboard/04-stash-and-annotations.md b/docs/guides/dashboard/04-stash-and-annotations.md index 6de217c7..9b244e61 100644 --- a/docs/guides/dashboard/04-stash-and-annotations.md +++ b/docs/guides/dashboard/04-stash-and-annotations.md @@ -42,7 +42,7 @@ The ticker draws the new value the way its widget looks, without the key: | Key | Flash | On the ticker | |---|---|---| -| `md/v2/health`, `md/v1/health` | ๐Ÿฉบ | A dot in the health's color and the state, such as `โ— degraded` | +| `md/v1/health` | ๐Ÿฉบ | A dot in the health's color and the state, such as `โ— degraded` | | `md/v1/usage` | ๐Ÿ“Š | A small bar and the usage, colored like the side panel's bar | | `md/v1/traffic` | ๐Ÿ“ˆ | The rate, errors, and p95 latency, such as `1.2k/s ยท โœ•12 ยท 340ms` | | `md/v1/banner` | ๐Ÿ“ฃ | `โš‘` and the message, colored by level | @@ -62,8 +62,7 @@ A [well-known key](/guides/stash/well-known-keys) draws its widget for everyone | Key | Set on | In Massdriver Constellation | |---|---|---| -| `md/v2/health` | Instance | The instance's dot, and its state in the side panel. The dot has the `color` of the value: `green`, `amber`, `red`, `blue`, `purple`, `gray`, or a hex color such as `#7C3AED`. Without a color, the state sets the color, as in `md/v1/health`. A red instance blinks on the map. When an instance has both keys, the map shows `md/v2/health`. | -| `md/v1/health` | Instance | The instance's dot, and its health in the side panel: green for `healthy`, `ok`, or `up`; amber for `degraded`, `warning`, or `recovering`; red for `down`, `failed`, or `error`; gray for anything else. A red instance blinks on the map. This key still works. | +| `md/v1/health` | Instance | The instance's dot, and its state in the side panel. The dot has the `color` of the value: `green`, `amber`, `red`, `blue`, `purple`, `gray`, or a hex color such as `#7C3AED`. Without a color, the state sets the color: green for `healthy`, `ok`, or `up`; amber for `degraded`, `warning`, or `recovering`; red for `down`, `failed`, or `error`; gray for anything else. A red instance blinks on the map. | | `md/v1/usage` | Instance | A bar under the instance in the side panel, such as `โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 82/100 connections`. Amber from 80%, red from 95%. | | `md/v1/traffic` | Instance | The links that leave the environment carry the rate, p95 latency, and errors, and the sparks follow the rate. A rate of 0 shows no sparks. | | `md/v1/banner` | Environment | A banner across the top of the map, a โš‘ next to the environment, and the message in the side panel, colored by level | @@ -72,7 +71,7 @@ A [well-known key](/guides/stash/well-known-keys) draws its widget for everyone For example: ```bash -mass alpha stash set billing-dev-app.md/v2/health '{"state": "Rolling out", "color": "blue"}' --format json +mass alpha stash set billing-dev-app.md/v1/health '{"state": "Rolling out", "color": "blue"}' --format json mass alpha stash set billing-dev-app.md/v1/usage '{"value": 37, "max": 100, "label": "connections"}' --format json mass alpha stash set billing-dev-app.md/v1/traffic '{"rps": 240, "errors_5m": 2, "p95_ms": 85}' --format json mass alpha stash set billing-dev.md/v1/banner '{"message": "Deploy freeze until Friday", "level": "warning"}' --format json diff --git a/docs/guides/stash/01-overview.md b/docs/guides/stash/01-overview.md index 1679d378..fbe9f458 100644 --- a/docs/guides/stash/01-overview.md +++ b/docs/guides/stash/01-overview.md @@ -13,7 +13,7 @@ This feature is alpha. Names, fields, and behavior can change or be removed at a The stash keeps small values about your infrastructure next to the project, environment, component, instance, or deployment they describe. People, the Massdriver UI, the CLI, automations, and later deployment steps can all read them. -Each project, environment, component, instance, and deployment has its own stash. A stash holds key and value entries, such as `db/hostname` = `billing-dev.cluster-abc.us-east-1.rds.amazonaws.com` or `md/v1/health` = `healthy`. Massdriver keeps an entry until you delete it or until it expires. +Each project, environment, component, instance, and deployment has its own stash. A stash holds key and value entries, such as `db/hostname` = `billing-dev.cluster-abc.us-east-1.rds.amazonaws.com` or `md/v1/health` = `{"state": "healthy"}`. Massdriver keeps an entry until you delete it or until it expires. ## Who writes to the stash @@ -61,10 +61,10 @@ mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.md/v1/cost_estimate" \ ### Show live health, usage, and traffic on the canvas -Write `md/v2/health`, `md/v1/usage`, or `md/v1/traffic` on an instance. A status dot, a usage bar, or traffic on its lines shows on the canvas for everyone with `stash:view`. Set a TTL so that the widget goes away when the writer stops. +Write `md/v1/health`, `md/v1/usage`, or `md/v1/traffic` on an instance. A status dot, a usage bar, or traffic on its lines shows on the canvas for everyone with `stash:view`. Set a TTL so that the widget goes away when the writer stops. ```bash -mass alpha stash set billing-dev-app.md/v2/health '{"state": "degraded"}' --format json --ttl 600 +mass alpha stash set billing-dev-app.md/v1/health '{"state": "degraded"}' --format json --ttl 600 mass alpha stash set billing-dev-app.md/v1/traffic '{"rps": 240, "errors_5m": 2, "p95_ms": 180}' --format json --ttl 600 ``` diff --git a/docs/guides/stash/02-well-known-keys.mdx b/docs/guides/stash/02-well-known-keys.mdx index 9a8f8c94..424bd7c9 100644 --- a/docs/guides/stash/02-well-known-keys.mdx +++ b/docs/guides/stash/02-well-known-keys.mdx @@ -30,8 +30,7 @@ These are the widget keys: | Key | Set on | Format | Widget name | Widget | |---|---|---|---|---| -| `md/v2/health` | Instance | JSON | `instance.status_dot` | Status dot on the instance | -| `md/v1/health` | Instance | TEXT | `instance.status_dot` | Status dot on the instance | +| `md/v1/health` | Instance | JSON | `instance.status_dot` | Status dot on the instance | | `md/v1/usage` | Instance | JSON | `instance.usage_bar` | Usage bar on the instance | | `md/v1/traffic` | Instance | JSON | `link.traffic` | Traffic on the lines that leave the instance | | `md/v1/urls` | Instance | JSON | `instance.urls` | Docs, API, and App buttons in the instance panel | @@ -57,7 +56,7 @@ These are the scorecard keys: The server rejects a write to an `md/` key when: -- No widget in the catalog reads the key. This includes a key without a version, such as `md/health`. The error names the key to use, such as `md/v2/health`. +- No widget in the catalog reads the key. This includes a key without a version, such as `md/health`. The error names the key to use, such as `md/v1/health`. - The key is set on the wrong kind of entity. - A segment of the key is not one of its allowed values. - The format is not the one in the table. @@ -74,14 +73,14 @@ Each schema has an `$id` that names its key and version, such as `https://schema The `alphaWidgetCatalog` query returns these keys, their versions, and their schemas. See [GraphQL API](/guides/stash/api#alphawidgetcatalog). -## `md/v2/health` +## `md/v1/health` Set on an instance. Format: JSON. Shows the [status dot](/guides/annotations/widgets#status-dot). ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://schemas.massdriver.cloud/stash/md/v2/health.json", + "$id": "https://schemas.massdriver.cloud/stash/md/v1/health.json", "type": "object", "required": ["state"], "additionalProperties": false, @@ -102,31 +101,10 @@ Set on an instance. Format: JSON. Shows the [status dot](/guides/annotations/wid | `state` | The word shown with the dot, for example `Rolling out`. | | `color` | Optional. The color of the dot: `green`, `amber`, `red`, `blue`, `purple`, `gray`, or a hex color with six digits, such as `#7C3AED`. | -Without `color`, the dot has the color that [`md/v1/health`](#mdv1health) gives the state. When an instance has both keys, the dot shows `md/v2/health`. - -```bash -mass alpha stash set billing-dev-app.md/v2/health '{"state": "Rolling out", "color": "blue"}' --format json -``` - -## `md/v1/health` - -Set on an instance. Format: TEXT. Shows the [status dot](/guides/annotations/widgets#status-dot). This key still works. Use [`md/v2/health`](#mdv2health) to set the color of the dot. - -```json -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://schemas.massdriver.cloud/stash/md/v1/health.json", - "type": "string", - "minLength": 1, - "maxLength": 64, - "examples": ["healthy", "degraded", "down"] -} -``` - -The dot is green for `healthy`, `ok`, and `up`. It is amber for `degraded`, `warning`, and `recovering`. It is red for `down`, `failed`, and `error`. It is gray for any other value. +Without `color`, the state sets the color. The dot is green for `healthy`, `ok`, and `up`. It is amber for `degraded`, `warning`, and `recovering`. It is red for `down`, `failed`, and `error`. It is gray for any other state. ```bash -mass alpha stash set billing-dev-app.md/v1/health degraded +mass alpha stash set billing-dev-app.md/v1/health '{"state": "Rolling out", "color": "blue"}' --format json ``` ## `md/v1/usage` diff --git a/docs/guides/stash/06-provisioners.md b/docs/guides/stash/06-provisioners.md index f86ec2ae..ff30e325 100644 --- a/docs/guides/stash/06-provisioners.md +++ b/docs/guides/stash/06-provisioners.md @@ -73,10 +73,10 @@ Do not put secrets in labels. A label is not encrypted. `--sensitive` encrypts a ## Widgets -The `md/v2/health`, `md/v1/usage`, and `md/v1/traffic` keys on the instance, and the `md/v1/banner` and `md/v1/links` keys on the environment, show [widgets](/guides/annotations/widgets) on the canvas. Health, usage, and traffic show live data. A provisioner can set a first value, for example `md/v2/health` with the state `healthy` after a successful apply. A metrics job, such as the [`stash-sync` automation](/guides/stash/recipes#sync-metrics-with-stash-sync), keeps the values current. +The `md/v1/health`, `md/v1/usage`, and `md/v1/traffic` keys on the instance, and the `md/v1/banner` and `md/v1/links` keys on the environment, show [widgets](/guides/annotations/widgets) on the canvas. Health, usage, and traffic show live data. A provisioner can set a first value, for example `md/v1/health` with the state `healthy` after a successful apply. A metrics job, such as the [`stash-sync` automation](/guides/stash/recipes#sync-metrics-with-stash-sync), keeps the values current. ```bash -mass alpha stash set "$MASSDRIVER_INSTANCE_ID.md/v2/health" '{"state": "healthy"}' --format json +mass alpha stash set "$MASSDRIVER_INSTANCE_ID.md/v1/health" '{"state": "healthy"}' --format json ``` ## Deployment results diff --git a/docs/platform-operations/event-destinations/events/02-projects-environments.md b/docs/platform-operations/event-destinations/events/02-projects-environments.md index e0fc34ee..4b443c2e 100644 --- a/docs/platform-operations/event-destinations/events/02-projects-environments.md +++ b/docs/platform-operations/event-destinations/events/02-projects-environments.md @@ -270,14 +270,14 @@ The attributes of the entity that holds the entry. For a deployment's entry, the "id": "9e4c2a7b-1d3f-4b6e-8a0c-5f2d7b9e1c34", "key": "md/v1/health", "label": "Health", - "format": "text", + "format": "json", "immutable": false, "sensitive": false, "expires_at": "2026-11-24T06:54:03Z", "updated_at": "2026-11-24T06:44:03Z", "scope": { "kind": "instance", "id": "api-prod-database" }, - "value": "degraded", - "data": null + "value": "{\"state\": \"degraded\"}", + "data": { "state": "degraded" } }, "actor": { "service_account_id": "c3e9a7b2-5d1f-4a8e-b6c0-9f2d4e7a1b85", @@ -302,6 +302,6 @@ The attributes of the entity that holds the entry. For a deployment's entry, the | To send | Events | Condition | |---|---|---| -| Health changes to `down` | `stash_entry.set` | `.data.entity.key == "md/v1/health" and .data.entity.value == "down"` | +| Health changes to `down` | `stash_entry.set` | `.data.entity.key == "md/v1/health" and .data.entity.data.state == "down"` | | Banners in production | `stash_entry.set` | `.data.entity.key == "md/v1/banner" and .data.attributes["md-environment"] == "prod"` | | Entries deleted by a person | `stash_entry.deleted` | `.data.actor.account_id != null` | diff --git a/docs/reference/cli/commands/mass_alpha_stash.md b/docs/reference/cli/commands/mass_alpha_stash.md index 026d2b36..82f17f00 100644 --- a/docs/reference/cli/commands/mass_alpha_stash.md +++ b/docs/reference/cli/commands/mass_alpha_stash.md @@ -80,7 +80,7 @@ mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.md/v1/changes/$MASSDRIVER_STEP_P Show an instance's health on the canvas for ten minutes: ```bash -mass alpha stash set billing-dev-app.md/v1/health degraded --ttl 600 +mass alpha stash set billing-dev-app.md/v1/health '{"state": "degraded"}' --format json --ttl 600 ``` Show a maintenance banner on an environment for two hours: