Skip to main content

Widgets

Alpha

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 has stash:view on 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โ€‹

KeySet onFormatWidget
md/v1/healthInstanceTEXTStatus dot
md/v1/usageInstanceJSONUsage bar
md/v1/trafficInstanceJSONTraffic on the lines that leave the instance
md/v1/bannerEnvironmentJSONBanner
md/v1/linksEnvironmentJSONHeader 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โ€‹

StateLooks likeValueMeaning
Healthybilling-dev-apphealthy, ok, or upA green dot.
Degradedbilling-dev-appdegraded, warning, or recoveringAn amber dot.
Downbilling-dev-appdown, failed, or errorA red dot.
Unknownbilling-dev-appany other textA 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.

InputTypeRequiredExample keyPath
statestringyesstatus/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 }
}
}
FieldMeaning
valueThe amount in use.
maxThe limit.
labelOptional. 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โ€‹

StateLooks likeValueMeaning
Under 80%billing-dev-appconnections37 / 100{"value": 37, "max": 100, "label": "connections"}A teal bar.
80% to 94%billing-dev-appconnections86 / 100{"value": 86, "max": 100, "label": "connections"}An amber bar.
95% or morebilling-dev-appconnections97 / 100{"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
InputTypeRequiredExample keyPath
valuenumberyesdb/connections on the instancenone
maxnumberyesdb/max_connections on the instancenone
labelstringnononenone

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 }
}
}
FieldMeaningInput
rpsRequests per second.rate
errors_5mErrors in the last 5 minutes.errors
p95_msOptional. 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โ€‹

StateLooks likeValueMeaning
Offapidatabasekey missing or expiredThe line shows as usual.
Idleapidatabase0 rps{"rps": 0, "errors_5m": 0}Rate 0. A thin gray dashed line.
Flowingapidatabase240 rps ยท 180 ms{"rps": 240, "errors_5m": 0, "p95_ms": 180}Rate above 0 and no errors. A teal line.
Some errorsapidatabase240 rps ยท 3 err ยท 180 ms{"rps": 240, "errors_5m": 3, "p95_ms": 180}1 to 9 errors. An amber line.
Many errorsapidatabase240 rps ยท 42 err ยท 180 ms{"rps": 240, "errors_5m": 42, "p95_ms": 180}10 or more errors. A red line.
Staleapidatabase240 rps ยท 180 ms ยท stalenot updated for 10 minutesThe line fades to half opacity.

The line width follows the rate:

RateWidth
under 103px
10 to 994px
100 to 9996px
1000 or more8px

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.

InputTypeRequiredExample keyPath
ratenumberyesstats/traffic on destination (JSON)rps
errorsintegeryesstats/traffic on destination (JSON)errors_5m
latencynumbernostats/traffic on destination (JSON)p95_ms

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"] }
}
}
FieldMeaning
messageThe banner text.
levelOptional. 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โ€‹

StateLooks likeValueMeaning
InfoDatabase upgrade tonight{"message": "Database upgrade tonight"}A blue banner.
WarningDeploy freeze until Friday{"message": "Deploy freeze until Friday", "level": "warning"}An amber banner.
ErrorPayments API is down{"message": "Payments API is down", "level": "error"}A red banner.
Two bannersDeploy freeze until FridayDatabase upgrade tonightmd/v1/banner and a pinned bannerBanners 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
InputTypeRequiredExample keyPath
messagestringyesstatus/maintenance on the environmentnone
levelstringnononenone

A pinned banner with a level that is not info, warning, or error shows as info.

Link buttons in the environment header, such as a dashboard or a runbook. A button opens its URL in a new tab.

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])" }
}
}
}
}
}
FieldMeaning
links[].labelThe button text.
links[].urlAn 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โ€‹

StateLooks likeValueMeaning
One linkbilling / devShop โ†—{"links": [{"label": "Shop", "url": "https://shop.example.com"}]}One button.
Two linksbilling / devShop โ†—Grafana โ†—two items in linksOne button per item.
Not an http URLbilling / devShop โ†—{"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"
InputTypeRequiredExample keyPath
linksarrayyeslinks 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 typeAccepted values
numberA JSON number, or a text value such as 42, -3, or 12.5
integerA whole number, as a JSON number or as text such as 3
stringText
arrayA 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 toStashes you can choose
An instanceproject, environment, component, instance
A lineproject, environment, source, destination
An environmentproject, environment