Skip to main content
Rounding adjusts the result after Lago aggregates your events. For example, a metric that measures compute hours can return a whole number of hours or a value with two decimal places. By default, Lago leaves the aggregated value unchanged.

Rounding options

Set rounding_function to choose how Lago rounds the quantity:
  • ceil: rounds up.
  • floor: rounds down.
  • round: rounds to the nearest value.
Use rounding_precision to set the number of decimal places.

Precision

These examples use rounding_function: round.

Example: compute hours

A billable metric measures 10.2 hours of compute usage during a billing cycle. With no precision set, each rounding option gives the following result:

Apply rounding

Once the metric is attached to a Plan, only its name, description and permitted filter changes can be updated. Set rounding before you attach the metric.
On the configuration page of your billable metric, enable rounding, select ceil, floor or round, and set an optional precision.

Aggregation types

How the value is aggregated before rounding.

Rates

Price the rounded quantity.

Create a billable metric (API)

POST /billable_metrics

Update a billable metric (API)

PUT /billable_metrics/{code}