VayuDocumentationIntegrationsAPI ReferenceChange Log
SupportGet started now
GuidesProducts

Metered Products

Define a metered product: which events count, how they're aggregated, and how to test it.

A metered product turns the events you send to Vayu into billable usage. It's defined by three things:

  1. Event name: which events count, for example request_made.
  2. Conditions (optional): which of those events count, for example only status equal to 200.
  3. Aggregation: how the matching events become a number, for example the count of events or the sum of a field.

When you add usage-based pricing, such as per-unit or tiered, to a plan or contract, you pick a metered product. Vayu prices the number that product produces. See Usage-Based Fees.

Send events before you create a metered product. The event names and fields you can choose from come from the events Vayu has received. See Sending events.

Create a Metered Product

Go to Products, click Create product, select Metered product, and click Next.

Choose a product type

The product builder opens as a full page with three steps: Product settings, Metering, and Review. Use Next and Back to move between steps. What you enter is kept as you go back and forth.

Create a metered product

Step 1: Product Settings

FieldRequiredDescription
NameYesThe product name shown on plans, contracts, and invoices
UnitsYesWhat one unit is called, such as tokens or minutes
Product code (Optional)NoYour own code for the product
CreditsNoThe credit products that can pay for this usage
Description (Optional)NoWhat the product measures and why
This product is taxableNoOn by default

If you've connected NetSuite, QuickBooks, Xero, Paddle, Anrok, or Stripe Tax, an ERP Integrations section lets you map the product to a record in each connected system.

Product settings step

Step 2: Metering

Under Measure with, choose No-Code to build the meter from fields, or SQL Builder to write a query. SQL Builder appears only if it's enabled on your account.

No-Code

  • Event name: under When this event name is, pick the event to count.
  • Conditions (optional): click Add condition, then choose a Field, a Criterion, and a Value. Rows in one group are joined with And: an event must match all of them. Click Or to add another group. An event that matches any group counts.
  • Aggregation: choose how matching events are combined. Every method except Count also needs a Field.

Metering step with conditions

AggregationResult
CountThe number of matching events
SumThe total of a field
DistinctThe number of distinct values of a field
Max / MinThe largest or smallest value of a field
AverageThe average value of a field
First / LastThe earliest or latest value of a field. Use Last for running totals, like stored records

Aggregation options

Criteria you can use in conditions: Equals, Doesn't equal, Has, Is any of, Contains (the default), Doesn't contain, Larger than, Lower than, Lower or equal to, Larger or equal to, Exists, and Doesn't exist.

SQL Builder

Write a ClickHouse SQL query in Your query. Read event fields as raw_data.{your_field_name}, and return one row per day with the columns day and value.

SQL Builder

If a product already uses SQL but SQL Builder isn't enabled on your account, the query is read-only. Contact Vayu to change it.

Test the Meter

Click Show preview in the top bar to open the Test meter panel. It lets you check how many events this meter matches, without saving. Pick a date range (it defaults to the last 30 days) and click Test, or press ⌘/Ctrl+Enter. Results only update when you run a test.

The panel shows Matched events, Total value, the value for each day, and sample events. If nothing matches, widen the date range or your conditions. A failed test doesn't affect saving the product.

Metering step with the Test meter panel open

A close-up of the panel:

Test meter results: matched events, total value, daily values and sample events

Step 3: Review

Check the Product settings and Metering summaries, including the event name, conditions, and aggregation (or the SQL Query), then click Create product.

Review step

If you leave the builder with unsaved changes, Vayu asks you to confirm before discarding them.

Edit a Metered Product

Open the product and click Edit, or choose Edit from the row menu. The same three steps open. The Review step shows your changes. Click Save changes, then confirm in the You're about to update this product dialog.

Confirm update dialog

On this page