You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently some customers are not being billed for API usage overages compared to their actual usage.
Part of this seems tied up with the current issue where current API usage notifications are missing alerts at lower thresholds, see #5069
Some users are being billed at repeated thresholds at their current maximum, for example see this organisation in Metabase:
select*from organisations_organisationapiusagenotification
where organisation_id =7201order by notified_at asc;
The code involved is likely at issue. See the task charge_for_api_call_count_overages in organisations/tasks.py. The code roughly does the following:
It processes API overage charges for monthly subscribers nearing the end of their billing cycle. It first identifies organizations that have been flagged for exceeding 100% of their API usage in the past 30 days and filters for those whose billing terms are about to close (roughly a 25–35 day window). For each eligible organization with the proper feature flag enabled, it calculates the current API usage and checks whether it exceeds twice the allowed limit—if it does, and after accounting for any previous overage adjustments, it determines the number of 100,000-call increments by which the usage has surpassed the limit. Depending on whether the organization is on a Scale Up or Start Up plan, it applies the appropriate overage charge and logs a billing record to avoid duplicate charges, while also handling any errors that might occur during the billing process.
Looking into the billing failure, it seems like both startup and scaleup plans are involved in the API usage notifications:
select plan, count(*)
from organisations_organisationapiusagenotification ooaun
join organisations_subscription os onos.organisation_id=ooaun.organisation_idgroup by plan;
But the problem seems like not enough of the organisations are being billed properly. For example look at the following SQL query:
Currently some customers are not being billed for API usage overages compared to their actual usage.
Part of this seems tied up with the current issue where current API usage notifications are missing alerts at lower thresholds, see #5069
Some users are being billed at repeated thresholds at their current maximum, for example see this organisation in Metabase:
The code involved is likely at issue. See the task
charge_for_api_call_count_overages
inorganisations/tasks.py
. The code roughly does the following:It processes API overage charges for monthly subscribers nearing the end of their billing cycle. It first identifies organizations that have been flagged for exceeding 100% of their API usage in the past 30 days and filters for those whose billing terms are about to close (roughly a 25–35 day window). For each eligible organization with the proper feature flag enabled, it calculates the current API usage and checks whether it exceeds twice the allowed limit—if it does, and after accounting for any previous overage adjustments, it determines the number of 100,000-call increments by which the usage has surpassed the limit. Depending on whether the organization is on a Scale Up or Start Up plan, it applies the appropriate overage charge and logs a billing record to avoid duplicate charges, while also handling any errors that might occur during the billing process.
Looking into the billing failure, it seems like both startup and scaleup plans are involved in the API usage notifications:
But the problem seems like not enough of the organisations are being billed properly. For example look at the following SQL query:
Only 34 ever existing records are present, with many records deleted from the table.
The text was updated successfully, but these errors were encountered: