For the complete documentation index, see llms.txt. This page is also available as Markdown.

Business metrics

Business metric YAML structure: required and optional properties, dimensions, segments, cross-model metrics, time granularity, forbidden legacy keys, reserved names, and validation rules.

Business metrics are time-series analytical definitions that combine a measure, a time dimension, and optional grouping dimensions into a single queryable unit. They sit on top of semantic models and are the primary interface for dashboards, reports, and APIs.


Where these files live

Put each metric in its own file under models/metrics/, one metric per file:

models/metrics/
├── arr_growth.yml
├── churn_analysis.yml
├── cohort_retention.yml
└── product_engagement.yml

File naming: the filename does not matter. Vulcan reads every YAML file in models/metrics/. Naming files after the metric they define keeps diffs and ownership clean.


Structure

A metric is a single document with kind: metric at the top. Reference measures, time columns, dimensions, and segments using <semantic_name>.<field> notation, where <semantic_name> is the value of the name: field at the top of the corresponding semantic model.

kind: metric
name: <metric_name>                         # Unique metric name
measure: <semantic_name>.<measure_name>     # Which measure to calculate
ts: <semantic_name>.<column_name>           # Time column for time-series analysis
granularity: <granularity>                  # Default time bucket

dimensions:                                 # Optional list of grouping dimensions
  - <semantic_name>.<column_name>           # Bare reference: name auto-derived from <column_name>
  - name: <slice_name>                      # Named slice: explicit name + ref (+ optional metadata)
    ref: <semantic_name>.<column_name>

segments:                                   # Optional list of predefined filters (strings only)
  - <semantic_name>.<segment_name>          # Auto-derived name: <semantic_name>_<segment_name>

description: "..."                          # Optional
owner: "..."                                # Optional
tags: [...]                                 # Optional
terms: [...]                                # Optional
ai_context: {...}                           # Optional, see models.md#ai-context

Properties

Property
Required
Type
Description

kind

Yes

Literal metric

Fixed value that marks this YAML document as a metric.

name

Yes

String

Unique identifier consumers use to reference the metric. See name.

measure

Yes

<semantic_name>.<measure_name>

The measure this metric aggregates. Anchors the metric to one semantic model. See measure.

ts

Yes

<semantic_name>.<column_name>

The time column for time-series aggregation. See ts.

granularity

Yes

Granularity value (day, month, ...)

Default time bucket. See granularity.

dimensions

No

List

Grouping dimensions (bare reference, or named slice with name + ref). See Dimensions.

segments

No

List of <semantic_name>.<segment_name>

Predefined filters from semantic models. Qualified-ref strings only; no named form. See Segments.

join_path

No

connected | directed

Per-metric override of the project's metric_join_path setting for cross-model reachability. See Join path mode.

description

No

String

Human-readable explanation of the metric.

owner

No

String

Team or person responsible for the metric.

tags

No

List of strings

Categorization labels for discovery. See Naming rules for the allowed pattern.

terms

No

List of strings

Business glossary references (e.g. glossary.revenue). See Naming rules.

ai_context

No

Object

Hints for AI/LLM consumers (instructions, synonyms, examples). See AI context.

measure, ts, granularity, and name are the 4 fields every metric must define; every other row is optional. Details on each field follow below.


Required properties

Every business metric must set these.

name

Unique identifier consumers use to reference the metric. Must be unique within the project.

measure

A reference to a measure defined in a semantic model, in the format <semantic_name>.<measure_name>.

subscriptions here is the name: at the top of the subscriptions semantic model file; total_arr is one of its measures.

ts

A reference to a time/date column on a semantic model, in the format <semantic_name>.<column_name>. This is the time column used for time-series aggregation.

measure and ts cannot be the same

Vulcan rejects metrics where measure and ts point to the same reference.

granularity

The default time bucket for aggregation. Must be one of:

Value
Bucket

second

Per-second

minute

Per-minute

hour

Hourly

day

Daily

week

Weekly

month

Monthly

quarter

Quarterly

year

Yearly

The default granularity applies when a consumer queries the metric without specifying one. Consumers can always override it at query time.


Optional properties

See the combined Properties table above for the full list (dimensions, segments, join_path, description, owner, tags, terms, ai_context). ai_context is the one optional property whose shape is worth showing in full:


Dimensions

dimensions: is a list. Each item can be either a bare reference to a column, or a named slice that gives the column a different display name.

Bare reference

The most common form. Point at a column on a semantic model:

The dimension's name is auto-derived from the field part after the . (so subscriptions.plan_type becomes plan_type, users.signup_channel becomes signup_channel). The derived name is what consumers use in queries.

Named slice

Use the named form when you want to expose a dimension under a different label than the underlying column, disambiguate 2 columns that would derive the same shorthand name, or override the semantic field's documentation/tags/terms/AI hints for this metric:

Field
Required
Description

name

Yes

The label consumers use in queries. Lowercase identifier (see Naming rules). Must be unique across this metric's dimensions and segments.

ref

Yes

The actual semantic reference (<semantic_name>.<column>). Both halves must be valid identifiers.

description

No

Human-readable explanation. Overrides the description on the underlying semantic field for this metric.

tags

No

List of categorization labels. Overrides the underlying field's tags for this metric.

terms

No

List of business glossary references. Overrides the underlying field's terms for this metric.

ai_context

No

Hints for AI/LLM consumers (instructions, synonyms, examples). Overrides the underlying field's ai_context for this metric.

Override scope

Overrides apply only to this metric's view of the dimension. Other metrics referencing the same column still see whatever is defined on the semantic model.

You can freely mix bare references and named slices in the same dimensions: list:

Dimensions can reference columns from any semantic model, as long as the models are connected through joins.


Segments

Segments apply predefined filters from semantic models to a metric. Reference them using <semantic_name>.<segment_name>:

The segments active_subscriptions and high_value_accounts must be defined in the subscriptions semantic model. Vulcan applies these filters automatically when someone queries the metric.

Segment rules

Aspect
Rule

Entry type

Must be a qualified-reference string. Dict / object form is rejected by the parser.

ref shape

<semantic_name>.<segment_name>. Both halves must be valid identifiers.

Auto-derived name

<semantic_name>_<segment_name>, lowercased. Must match ^[a-z][a-z0-9_]{0,63}$ and must not collide with any dimension name on this metric.

Per-entry metadata

Not supported. Unlike dimensions, segments on a metric cannot carry per-entry description, tags, terms, or ai_context. To override segment metadata, edit it on the underlying semantic model.

Example of how derived names work:


Cross-model metrics

A metric can pull its measure, ts, and dimensions from different semantic models. Vulcan resolves the join paths automatically based on the joins defined in your semantic models.

This metric uses the active_users measure and signup_date time from the users model, but groups by plan_type from the subscriptions model. The semantic models must be connected by a valid join path. With the default directed mode, that path must follow outgoing joins: edges from the metric's anchor model.

Join path mode: connected vs directed

measure always anchors the metric to one semantic model. Every other model referenced by ts, dimensions, or segments is checked for reachability from that anchor, in one of two modes:

Mode
Behavior

directed (default)

A join must exist that follows outgoing joins: edges starting from the anchor model. A reference reachable only by walking a join backwards, or through a model that joins into the anchor, fails validation.

connected

Any join path between the anchor and the referenced model counts, regardless of which model declared the join or its direction.

The effective mode comes from, in order of precedence: the metric's own join_path: key, then the project's metric_join_path: setting in config.yaml, then the built-in default of directed.

If a directed check fails, the error names the anchor and the unreachable model and suggests three fixes: declare a join from the anchor toward the target, move the measure onto the target model instead, or relax the check with join_path: connected on the metric (or metric_join_path: connected project-wide). This is useful when models are legitimately connected through a reciprocal join but the only usable path runs against the directed edge.

metric_join_path also controls export: directed populates the join_map in exported metadata/BI artifacts, while connected leaves it empty. See the project config.yaml reference for the metric_join_path setting.


Time granularity

Define a metric once, query it at any granularity. The granularity: value sets the default, but consumers can override it at query time:

  • granularity=day

  • granularity=week

  • granularity=month

  • granularity=quarter

  • granularity=year

You do not need separate metric definitions for daily, weekly, and monthly views of the same data.


Querying metrics

Metric queries are available over GET and POST, and the two differ in how result ordering works:

Method
Ordering

GET

Returns results latest-first by the metric's ts time dimension. This is the only ordering behavior; GET does not accept an order parameter.

POST

Accepts an explicit order field, validated against ts and the metric's selected dimensions. No default ordering is applied when order is omitted.


Examples

Four metrics of increasing complexity, from the bare minimum to a full definition with segments, tags, and terms.

Minimal

The smallest valid metric is the 4 required fields:

With dimensions and description

Cross-model with named slice

Full example with segments, tags, terms


Forbidden legacy keys

Two keys from earlier versions of the metric spec are explicitly rejected and cause validation to fail:

Legacy key
Use instead
Notes

time

ts

The time-column field was renamed.

slices

dimensions

The grouping field was renamed and switched from a dict to a list.

If you are migrating an older project, do a global replace before running vulcan plan.


Reserved names

You cannot use the following names as a dimension name (object form) or as the auto-derived name of a segment on a metric:

  • measure

  • time

  • ts

They are reserved as adjunct keys on the metric envelope. Pick a different name (for example, plan_type instead of time). For segments, this means you cannot reference a segment whose <semantic_name>_<segment_name> derivation collides with one of the reserved names.


Validation

Vulcan validates metric definitions automatically when you create a plan. It checks that:

  • measure, ts, and each dimension/segment ref resolve to a declared semantic field (a dimension, measure, or segment name) on their semantic model, not necessarily a raw physical column

  • ts additionally resolves to a physical column of a strict timestamp type (TIMESTAMP, TIMESTAMPTZ, TIMESTAMPNTZ, TIMESTAMPLTZ, DATETIME, DATETIME2); DATE, TIME, and INTERVAL are rejected with a cast hint

  • granularity is a recognized granularity value (see granularity table)

  • Every qualified reference (measure, ts, and each dimension/segment ref) is a valid <semantic_name>.<field> where both halves are valid identifiers

  • All qualified refs used by the metric are unique. You cannot use the same <semantic_name>.<field> as both measure and ts, or as 2 dimensions, and so on.

  • All names are unique across dimensions and segments (dimension names plus auto-derived segment names, considered as one combined set)

  • Named slices include both name and ref

  • Segment entries are qualified-reference strings (not objects) and their auto-derived <semantic_name>_<segment_name> matches the lowercase identifier pattern

  • Every semantic model referenced by the metric (beyond the measure's own model) is reachable from the measure's anchor model through the join graph, per the effective connected/directed join path mode

  • join_path, if set, is connected or directed

  • Forbidden legacy keys (time, slices) are not present

  • Reserved names (measure, time, ts) are not used as a dimension or auto-derived segment name

  • All identifier names match the naming rules

  • No unknown keys appear inside ai_context (Pydantic extra="forbid")


Next steps

  • Learn about Semantic Models: the source of measures, segments, and joins that metrics build on.

  • See the Semantics Overview for the complete picture

  • Explore metric definitions in your project's models/metrics/ directory

Last updated

Was this helpful?