Skip to content

Conversation

@vincent-pochet
Copy link
Collaborator

@vincent-pochet vincent-pochet commented Dec 5, 2025

Context

This PR follows #4676 as a part of the "pre-filter" events feature

Description

The goal of this one is to:

  • Add a new pre_filter_events flag to the organization model
  • Rework the Events::BillingPeriodFilterService to return only charges and filters that effectively received usage in the period when the feature is turned on. It relies on the events_enriched_expanded table of Clickhouse
  • Use the returned charge_ids and charge_filter_ids in the billing related services (namely Invoices::CalculateFeesService, Invoices::CustomerUsageService and Invoices::ProgressiveBillingService)
  • Update the Fees::ChargeService to take advantage of this filters, by turning the byepass_aggregation argument into filtered_aggregations. This new argument can be nil (aggregating all charges and filters) or a list of charge_filter_ids (including nil for the default filter defined at charge level)

@vincent-pochet vincent-pochet force-pushed the feat-clickhouse-enriched branch from 5504e48 to 897eefe Compare December 5, 2025 14:41
Base automatically changed from feat-clickhouse-enriched to main December 8, 2025 08:23
@vincent-pochet vincent-pochet force-pushed the feat-clickhouse-enriched-real branch from b247325 to 9ec00cb Compare December 8, 2025 10:14
@vincent-pochet vincent-pochet force-pushed the feat-clickhouse-enriched-real branch from 9ec00cb to c704b9b Compare December 8, 2025 10:18
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.

3 participants