This feature is in private preview.Parameterized metrics are currently available to a limited set of customers. Reach out to your Orb contact to get access.
Why parameterized metrics
Without parameters, modeling customer-specific rates requires creating a separate billable metric for each variation — a “Revenue at 1.5x” metric, a “Revenue at 2.0x” metric, and so on. This approach doesn’t scale: every new contract negotiation means a new metric, and the list quickly becomes unmanageable. Parameterized metrics let you define the logic once:{{rate_multiplier}} placeholder is a parameter. When you create the metric, you give it a default value (e.g. 1.0). When you create a subscription, you can override that value per price interval — one customer might get 1.5, another 2.0, and a third might use the default.
Orb resolves the parameter values at billing time and substitutes them into the query, so every downstream feature — usage dashboards, alerts, invoices — works exactly as it does with standard metrics.
Defining parameters in SQL
Parameters use the{{parameter_name}} syntax inside a custom SQL metric definition. Parameter names must start with a letter or underscore and can contain alphanumeric characters and underscores.
CASE conditions, WHERE clauses, and so on. They are not limited to numeric values; string parameters work as well (e.g. for filtering by a configurable region or tier name).
Creating a parameterized metric
When you create a metric using custom SQL that contains{{...}} placeholders, Orb requires you to provide a parameter definition for each parameter. A parameter definition includes:
| Field | Description |
|---|---|
name | The parameter name, matching the {{name}} used in the SQL. |
default_value | The value to use when a subscription does not provide an override. Must be a number or string. |
default_value you provide. If the default is a number, Orb expects numeric overrides; if the default is a string, Orb expects string overrides.
API
When creating a metric via the API, include theparameter_definitions field:
Validation rules
Orb validates parameter definitions against the SQL at creation time:- Every
{{parameter}}in the SQL must have a corresponding definition. - Every definition must correspond to a
{{parameter}}in the SQL — you cannot define unused parameters. - A metric can have at most 10 parameter definitions.
- Each
default_valuemust be a number or a string.
Overriding parameters on a subscription
Once you’ve attached a parameterized metric to a price on a plan, you can provide parameter overrides when creating or editing a subscription. Overrides are set per price interval, so different prices on the same subscription can use different values for the same parameter.API
When creating a subscription, includeprice_metric_parameter_overrides:
metric_parameter_overrides use the default value from the metric definition.
The same price_metric_parameter_overrides field is available when editing a subscription or scheduling a plan change.
Validation rules
- Parameter names must match those defined on the metric.
- Override values must match the type of the parameter’s default value (numeric overrides for numeric defaults, string overrides for string defaults).
- You cannot provide overrides for a price whose metric has no parameter definitions.
How parameters are resolved
When Orb evaluates a parameterized metric — for invoicing, usage dashboards, or alerts — it resolves parameter values in the following order:- Subscription override: If the subscription’s price interval specifies an override for a parameter, that value is used.
- Metric default: If no override is provided, the default value from the metric’s parameter definition is used.
rate_multiplier resolved to 2.5:
Example use cases
Customer-specific rate multipliers A payments platform charges per transaction, but enterprise customers negotiate custom rates. Define a single metric with a{{rate_multiplier}} parameter and override it per subscription:
1.0. Customer A overrides to 0.8 (discounted). Customer B uses the default.
Regional pricing coefficients
A cloud provider charges differently for compute in different regions. Use a string parameter to filter by region and a numeric parameter for the regional rate:
100. Customers on a higher tier override to 500.
Limits
- A metric can have at most 10 parameter definitions.
- Parameter names must start with a letter or underscore and can only contain alphanumeric characters and underscores.
- Default values must be a number (
intorfloat) or a string.