Skip to content

MetricInstance

Provides access to a Metric’s Dimensions and starts queries over its projected contributions.

Metrics are derived entirely from projected Events and are read-only. Projection runs separately from the write that published an Event, so a Mutation can complete before its contribution is queryable. Reach a Metric through ctx.apps.<app>.metrics.<key>.

readonly dimensions: Record<string, DimensionInstance>

Dimensions declared on the Metric, keyed by their definition key.


readonly prn: string

PRN identifying this Metric within the definition.

getDimensionByPrn(prn): DimensionInstance

Returns the Dimension declared on this Metric with the given PRN.

string

PRN of a Dimension declared on this Metric.

DimensionInstance


query(func): MetricQueryBuilder

Starts a query over this Metric’s projected contributions.

MetricQueryFunction

Aggregate function the query is opened with.

MetricQueryBuilder

A builder to set the focal Dimension, grouping, interval, and period before executing.