diff --git a/docs/continuous-delivery/automations/19-statuspage.md b/docs/continuous-delivery/automations/19-statuspage.md index 7f1be533..372f6d65 100644 --- a/docs/continuous-delivery/automations/19-statuspage.md +++ b/docs/continuous-delivery/automations/19-statuspage.md @@ -53,7 +53,7 @@ An incident opens when a row becomes degraded or worse, and resolves when the ro | Key | Scope | On the page | |---|---|---| -| `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. diff --git a/docs/guides/annotations/03-widgets.mdx b/docs/guides/annotations/03-widgets.mdx index 5277976c..4f3be325 100644 --- a/docs/guides/annotations/03-widgets.mdx +++ b/docs/guides/annotations/03-widgets.mdx @@ -35,7 +35,7 @@ To hide automatic widgets, click the **Widgets** button in the canvas toolbar, a | Key | Set on | Format | Widget | Add by hand | |---|---|---|---|---| -| `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 | @@ -58,22 +58,34 @@ A colored dot in the header of an instance node. The tooltip shows the label and ### Automatic: `md/v1/health` -Set on the instance. Format: TEXT. +Set on the instance. Format: JSON. -The value must match the [`md/v1/health` schema](/guides/stash/well-known-keys#mdv1health). +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/v1/health degraded +mass alpha stash set billing-dev-app.md/v1/health '{"state": "Rolling out", "color": "blue"}' --format json ``` ### 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 state | Gray | The match ignores case and spaces at each end. @@ -84,6 +96,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..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/v1/health` | A colored dot and the value | +| 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 89f2ec81..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/v1/health degraded +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/v1/health healthy +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/04-stash-and-annotations.md b/docs/guides/dashboard/04-stash-and-annotations.md index 35cda861..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/v1/health` | ๐Ÿฉบ | A dot in the health's color and the health, 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,7 +62,7 @@ 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/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 | @@ -71,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/v1/health degraded +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 f5d81893..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 @@ -64,7 +64,7 @@ mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.md/v1/cost_estimate" \ 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/v1/health degraded --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 020afbeb..424bd7c9 100644 --- a/docs/guides/stash/02-well-known-keys.mdx +++ b/docs/guides/stash/02-well-known-keys.mdx @@ -30,7 +30,7 @@ These are the widget keys: | Key | Set on | Format | Widget name | Widget | |---|---|---|---|---| -| `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 | @@ -75,23 +75,36 @@ The `alphaWidgetCatalog` query returns these keys, their versions, and their sch ## `md/v1/health` -Set on an instance. Format: TEXT. Shows the [status dot](/guides/annotations/widgets#status-dot). +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/v1/health.json", - "type": "string", - "minLength": 1, - "maxLength": 64, - "examples": ["healthy", "degraded", "down"] + "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])" } + ] + } + } } ``` -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. +| 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 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 5525faff..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/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/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/v1/health" healthy +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: 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