Skip to content

Metric commands: define, query, watch

The Metric Verbs define, query, watch as CLI commands, with inputs, result, refusals and an example.

Reference for Metric, one group of Metric commands.

Metric.define

Define compiles a Metric’s query against the Startup’s Events and Entries and lists every Event it reads. Verb page.

Text
npx startup-builder do Metric.define --json '<input>' [--try | --send | --do]

Emits Metric.defined.

Inputs

InputTypeRequiredDescription
namestringrequiredThe Metric’s name.
querytextrequiredThe query, over Events and Entries.
unitstringrequiredWhat one unit of it is.

Returns

OutputTypeRequiredDescription
metricMetricrequiredThe defined Metric.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
npx startup-builder do Metric.define --json '{"name":"Leaseline","query":"Example query","unit":"Example unit"}'

Metric.query

Query reads Metrics or Events as a trend, funnel, retention curve, path or lifecycle, broken down by any property. Verb page.

Text
npx startup-builder do Metric.query --json '<input>' [--try | --send | --do]

Emits Metric.queried.

Inputs

InputTypeRequiredDescription
metricMetricThe Metric to read; omitted, the query names Events directly.
shapestringrequiredThe analysis to run.
breakdownstringThe property to split by, such as an Organization or a Motion.
windowstringThe time range, such as 30d.

Returns

OutputTypeRequiredDescription
rowsjsonrequiredThe result rows, each number with its readability.
metricMetricrequiredThe Metric read.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
npx startup-builder do Metric.query --json '{"shape":"trend"}'

Metric.watch

Watch alerts the owner of a Metric when it crosses a threshold, by a Task or a Message. Verb page.

Text
npx startup-builder do Metric.watch --json '<input>' [--try | --send | --do]

Emits Metric.watched.

Inputs

InputTypeRequiredDescription
metricMetricrequiredThe Metric to watch.
thresholdnumberrequiredThe value that trips it.
directionstringrequiredTrip when the Metric goes above or below the threshold.

Returns

OutputTypeRequiredDescription
watchWatchrequiredThe Watch that checks it.
metricMetricrequiredThe Metric now watched.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
npx startup-builder do Metric.watch --json '{"metric":"metric_GXFHAlK100","threshold":1,"direction":"above"}'