Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flexible aggregation) - Support flexible aggregation on billable metric #2704

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

nudded
Copy link
Contributor

@nudded nudded commented Oct 17, 2024

Context

Billable metrics only allow you to aggregate on 1 property field. Several customers like to have some sort of computation done, so they can be flexible on how they send the event data to Lago.

Here is an example: a customer wants to send started_at ,ended_at & replicas as the properties and calculate the value as (ended_at - started_at) * replicas / 3600 .

To facilitate this, this PR introduces a new pre-ingestion step. This step runs in between receiving the event and persisting it to the db (both Clickhouse & Postgres event stores are supported).
This ingestion step relies on allowing customers to define an ‘Expression’ that will be evaluated for every event.

The expression parsing and evaluation relies on the new https://github.com/getlago/lago-expression library

@nudded nudded force-pushed the feat-flexible-aggregation branch 2 times, most recently from 99fb1d4 to 3278914 Compare October 17, 2024 13:04
@nudded nudded changed the title feat(flexible aggregation) - Support flexible aggregation on billable metric. feat(flexible aggregation) - Support flexible aggregation on billable metric Oct 17, 2024
@nudded nudded force-pushed the feat-flexible-aggregation branch 4 times, most recently from 55e540f to 9d36ae0 Compare October 21, 2024 15:10
@vincent-pochet vincent-pochet force-pushed the feat-flexible-aggregation branch 2 times, most recently from 17439fe to 8ff8b64 Compare October 25, 2024 07:24
@nudded nudded marked this pull request as ready for review October 25, 2024 07:39
@nudded nudded force-pushed the feat-flexible-aggregation branch 2 times, most recently from 75bc326 to 8fffa66 Compare October 31, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants