Widgets
This feature is alpha. Names, fields, and behavior can change or be removed at any time without notice.
A widget is a built-in picture that shows stash values. There are two ways to show one.
- Automatic. Write a well-known key that starts with
md/. Everyone who hasstash:viewon the stash sees the widget. - Pinned. Add a widget yourself and choose a stash entry for each input. Only you see it.
When you pin a widget in the same spot as an automatic one, you see your widget instead. If your widget has no value, you see the automatic one.
Each widget has a tooltip. It shows the widget's label and value, for example Connection pool: 37 of 100 (37%), and when the stash entry was last updated, for example Updated 2m ago. The label is the stash entry's label, which you set with --label. A usage bar without an entry label uses the label field of its value. Otherwise the widget uses a default label: Health, Traffic, or Usage.
To hide automatic widgets, click the Widgets button in the canvas toolbar, after the inactive instances button. The setting is saved in your browser and applies only to you. Your pinned widgets still show.
Well-known keysโ
| Key | Set on | Format | Widget |
|---|---|---|---|
md/v1/health | Instance | TEXT | Status dot |
md/v1/usage | Instance | JSON | Usage bar |
md/v1/traffic | Instance | JSON | Traffic on the lines that leave the instance |
md/v1/banner | Environment | JSON | Banner |
md/v1/links | Environment | JSON | Header links |
Each key has a version in its name: md/v<version>/<name>. When a stash has more than one version of a key, the widget uses the highest version. See Versions.
The md/ prefix is reserved. The server rejects a write to an md/ key when:
- No widget reads the key.
- The key is set on the wrong kind of entity.
- The entry is sensitive.
- The format is not the one in the table.
- The value does not match the key's schema.
Status dotโ
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โ
Set on the instance. Format: TEXT.
{
"$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"]
}
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. |
The match ignores case and spaces at each end.
Use your own stash keysโ
Right-click an instance and choose Add widget > Status dot.
| Input | Type | Required | Example key | Path |
|---|---|---|---|---|
state | string | yes | status/health on the instance (TEXT) | none |
Usage barโ
A thin bar at the bottom of an instance node. The label is on the left of the bar. The value and the limit, for example 37 / 100, are on the right.
Automatic: md/v1/usageโ
Set on the instance. Format: JSON.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.massdriver.cloud/stash/md/v1/usage.json",
"type": "object",
"required": ["value", "max"],
"additionalProperties": false,
"properties": {
"value": { "type": "number", "minimum": 0 },
"max": { "type": "number", "exclusiveMinimum": 0 },
"label": { "type": "string", "maxLength": 64 }
}
}
| Field | Meaning |
|---|---|
value | The amount in use. |
max | The limit. |
label | Optional. The label on the left of the bar, when the entry has no --label. |
mass alpha stash set billing-dev-app.md/v1/usage '{"value": 37, "max": 100, "label": "connections"}' --format json
What it looks likeโ
| State | Looks like | Value | Meaning |
|---|---|---|---|
| Under 80% | {"value": 37, "max": 100, "label": "connections"} | A teal bar. | |
| 80% to 94% | {"value": 86, "max": 100, "label": "connections"} | An amber bar. | |
| 95% or more | {"value": 97, "max": 100, "label": "connections"} | A red bar. |
A value above max fills the bar.
Use your own stash keysโ
Right-click an instance and choose Add widget > Usage bar. Each input can read a different key. For example, two TEXT entries:
mass alpha stash set billing-dev-app.db/connections 37
mass alpha stash set billing-dev-app.db/max_connections 100
| Input | Type | Required | Example key | Path |
|---|---|---|---|---|
value | number | yes | db/connections on the instance | none |
max | number | yes | db/max_connections on the instance | none |
label | string | no | none | none |
A pinned bar with a max of 0 or less does not show.
Trafficโ
The traffic on a line between two instances, shown as the width, color, and movement of the line. A short label on the line shows the rate, the errors, the p95 latency, and "stale" when the data is old. For example, 240 rps ยท 2 err ยท 180 ms. The label leaves out the errors when there are none, and the latency when there is no value.
Automatic: md/v1/trafficโ
Set on the instance that sends the traffic. Format: JSON. Every line that leaves that instance shows the traffic.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.massdriver.cloud/stash/md/v1/traffic.json",
"type": "object",
"required": ["rps", "errors_5m"],
"additionalProperties": false,
"properties": {
"rps": { "type": "number", "minimum": 0 },
"errors_5m": { "type": "integer", "minimum": 0 },
"p95_ms": { "type": "number", "minimum": 0 }
}
}
| Field | Meaning | Input |
|---|---|---|
rps | Requests per second. | rate |
errors_5m | Errors in the last 5 minutes. | errors |
p95_ms | Optional. p95 latency in milliseconds. | latency |
mass alpha stash set billing-dev-app.md/v1/traffic '{"rps": 240, "errors_5m": 2, "p95_ms": 180}' --format json
Write the entry on a schedule. When it is not updated for 10 minutes, the line shows as stale. Add --ttl to remove the entry, and the widget, after a time.
What it looks likeโ
| State | Looks like | Value | Meaning |
|---|---|---|---|
| Off | key missing or expired | The line shows as usual. | |
| Idle | {"rps": 0, "errors_5m": 0} | Rate 0. A thin gray dashed line. | |
| Flowing | {"rps": 240, "errors_5m": 0, "p95_ms": 180} | Rate above 0 and no errors. A teal line. | |
| Some errors | {"rps": 240, "errors_5m": 3, "p95_ms": 180} | 1 to 9 errors. An amber line. | |
| Many errors | {"rps": 240, "errors_5m": 42, "p95_ms": 180} | 10 or more errors. A red line. | |
| Stale | not updated for 10 minutes | The line fades to half opacity. |
The line width follows the rate:
| Rate | Width |
|---|---|
| under 10 | 3px |
| 10 to 99 | 4px |
| 100 to 999 | 6px |
| 1000 or more | 8px |
On a line with traffic, dashes move from the source instance to the destination instance. Higher rates move faster. When your system asks for reduced motion, the line is solid and does not move.
Use your own stash keysโ
Right-click a line and choose Add widget > Traffic. You can read from the source or the destination instance.
| Input | Type | Required | Example key | Path |
|---|---|---|---|---|
rate | number | yes | stats/traffic on destination (JSON) | rps |
errors | integer | yes | stats/traffic on destination (JSON) | errors_5m |
latency | number | no | stats/traffic on destination (JSON) | p95_ms |
Bannerโ
A message across the top of the environment canvas. Banners stack.
Automatic: md/v1/bannerโ
Set on the environment. Format: JSON.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.massdriver.cloud/stash/md/v1/banner.json",
"type": "object",
"required": ["message"],
"additionalProperties": false,
"properties": {
"message": { "type": "string", "minLength": 1, "maxLength": 280 },
"level": { "enum": ["info", "warning", "error"] }
}
}
| Field | Meaning |
|---|---|
message | The banner text. |
level | Optional. info (blue, the default), warning (amber), or error (red). |
mass alpha stash set billing-dev.md/v1/banner '{"message": "Deploy freeze until Friday", "level": "warning"}' --format json
What it looks likeโ
| State | Looks like | Value | Meaning |
|---|---|---|---|
| Info | {"message": "Database upgrade tonight"} | A blue banner. | |
| Warning | {"message": "Deploy freeze until Friday", "level": "warning"} | An amber banner. | |
| Error | {"message": "Payments API is down", "level": "error"} | A red banner. | |
| Two banners | md/v1/banner and a pinned banner | Banners stack, one per widget. |
Use your own stash keysโ
Right-click an empty part of the canvas and choose Add widget > Banner. For example, a short-lived TEXT entry:
mass alpha stash set billing-dev.status/maintenance "Database upgrade tonight" --ttl 86400
| Input | Type | Required | Example key | Path |
|---|---|---|---|---|
message | string | yes | status/maintenance on the environment | none |
level | string | no | none | none |
A pinned banner with a level that is not info, warning, or error shows as info.
Header linksโ
Link buttons in the environment header, such as a dashboard or a runbook. A button opens its URL in a new tab.
Automatic: md/v1/linksโ
Set on the environment. Format: JSON. Each item in links is one button.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.massdriver.cloud/stash/md/v1/links.json",
"type": "object",
"required": ["links"],
"additionalProperties": false,
"properties": {
"links": {
"type": "array",
"minItems": 1,
"maxItems": 8,
"items": {
"type": "object",
"required": ["label", "url"],
"additionalProperties": false,
"properties": {
"label": { "type": "string", "minLength": 1, "maxLength": 40 },
"url": { "type": "string", "maxLength": 2048, "pattern": "^https?://[^\\s]+(?![\\s\\S])" }
}
}
}
}
}
| Field | Meaning |
|---|---|
links[].label | The button text. |
links[].url | An http or https URL. |
mass alpha stash set billing-dev.md/v1/links '{"links": [{"label": "Shop", "url": "https://shop.example.com"}, {"label": "Grafana", "url": "https://grafana.example.com/d/billing"}]}' --format json
What it looks likeโ
| State | Looks like | Value | Meaning |
|---|---|---|---|
| One link | {"links": [{"label": "Shop", "url": "https://shop.example.com"}]} | One button. | |
| Two links | two items in links | One button per item. | |
| Not an http URL | {"links": [{"label": "Shop", "url": "https://shop.example.com"}, {"label": "Files", "url": "ftp://files.example.com"}]} | The server rejects this value for md/v1/links. In a pinned widget, the link with the ftp URL does not show and the other links do. |
Use your own stash keysโ
Right-click an empty part of the canvas and choose Add widget > Header link. The widget has one input, links. Point it at a JSON entry that holds a list of links in the same shape as md/v1/links:
mass alpha stash set billing-dev.links '{"links": [{"label": "Shop", "url": "https://shop.example.com"}]}' --format json --label "Links"
| Input | Type | Required | Example key | Path |
|---|---|---|---|---|
links | array | yes | links on the environment (JSON) | links |
Each item is one button. The first 8 links with an http or https url show. A link without a label shows the URL host.
Pinned widget inputsโ
For each input of a pinned widget, you choose a stash, a key, and, for a JSON entry, a path to a field. The widget editor shows the current value or the reason an input is off.
Open Data this widget reads in the widget editor to see the inputs, the md/ key, its fields, and a mass alpha stash set command. Under Or use your own stash keys, the editor gives example entries and a mass alpha stash set command for each. Then set the inputs tells you which key and path to choose for each input.
| Input type | Accepted values |
|---|---|
| number | A JSON number, or a text value such as 42, -3, or 12.5 |
| integer | A whole number, as a JSON number or as text such as 3 |
| string | Text |
| array | A JSON list |
An input is off when its key is missing, expired, sensitive, or has the wrong type, or when its path is not in the JSON entry. A pinned widget shows only when every required input has a value.
| Pinned to | Stashes you can choose |
|---|---|
| An instance | project, environment, component, instance |
| A line | project, environment, source, destination |
| An environment | project, environment |