Metric
A Metric is a named measure computed from Events or Entries, always derived and never typed in.
Key Results, Experiments and Dashboards read the same Metric, so one number means one thing.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
query | text | required | How it is computed. An agent never varies the Metrics it is judged by. Never randomized. |
unit | string | The unit, such as dollars or percent. | |
status | string | required | One of draft or defined. |
Object
{
"$id": "https: //api.sb/ kilnbakery.com/ metrics/ metric_1",
"$type": "Metric",
"query": "Example query",
"unit": "Example unit",
"status": "draft"
}Relationships
- A Metric is computed from many Events: a Metric derives from Events and is never typed in.
computedFrom, inversefeeds. - A Metric is computed under many Policies: a Policy rules how Metrics are computed, such as revenue under revenue recognition.
computedUnder, inversecomputes. - A Metric is informed by many Surveys: Survey answers compute Metrics, such as a satisfaction score.
informedBy, inverseinforms. - A Metric is measured by many Experiments: one primary Metric judges an Experiment’s Variants; guardrail Metrics stop it.
measuredBy, inversemeasures. - A Metric is moved by many Plays: a Play exists to move named Metrics, read before and after every run.
movedBy, inversemoves. - A Metric read by many Key Results: a Key Result compares one Metric’s value against its baseline and target.
readBy, inversereads. - A Metric is shown on many Dashboards: a Dashboard reads out Metrics, each computed from Events and never typed in.
shownOn, inverseshows.
Lifecycle
| State | Meaning | Moves to |
|---|---|---|
draft (first) | Its query is written and not compiled, so nothing reads it. | defined by Metric.define |
defined | Its query compiles against the Startup’s Events and Entries; defining it again recompiles an edited query. | None: it ends here. |
Verbs
createCreates a Metric.POST /{namespace}/metricsgetReturns one Metric by id.GET /{namespace}/metrics/{id}listReturns Metrics, newest first, one page at a time.GET /{namespace}/metricsupdateChanges the given properties of a Metric.PATCH /{namespace}/metrics/{id}deleteDeletes a Metric; its history is kept.DELETE /{namespace}/metrics/{id}defineDefine compiles a Metric’s query against the Startup’s Events and Entries and lists every Event it reads.POST /{namespace}/metrics/definequeryQuery reads Metrics or Events as a trend, funnel, retention curve, path or lifecycle, broken down by any property.POST /{namespace}/metrics/querywatchWatch alerts the owner of a Metric when it crosses a threshold, by a Task or a Message.POST /{namespace}/metrics/{metric}/watch
Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.
| Operation | owner | admin | member | viewer |
|---|---|---|---|---|
Metric.create | Yes | Yes | Yes | No |
Metric.get | Yes | Yes | Yes | Yes |
Metric.list | Yes | Yes | Yes | Yes |
Metric.update | Yes | Yes | Yes | No |
Metric.delete | Yes | Yes | Yes | No |
Metric.define | Yes | Yes | Yes | No |
Metric.query | Yes | Yes | Yes | No |
Metric.watch | Yes | Yes | Yes | No |
Call it
Define the latest metric.Example
Monthly recurring revenue is a Metric whose query sums active Subscription Entries, with unit:. A pricing Experiment, the revenue Dashboard and the annual Key Result all read that one value.