Fixed
Project:
AI Metering
Version:
1.0.0-beta1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
6 Jul 2026 at 13:16 UTC
Updated:
6 Jul 2026 at 22:49 UTC
Jump to comment: Most recent
The ai_metering_usage table grows without bound - one row per AI call, forever. Nothing ever deletes old rows. The retention_days setting only bounds the dashboard's display window (AiMeteringController); it does not prune storage. On a busy site the table reaches millions of rows, and since all reporting (CostReporter, QuotaManager) aggregates live over the raw log with GROUP BY, dashboards slow down as the table grows and PII (per-user call history) is retained indefinitely.
hook_cron purge that deletes ai_metering_usage rows older than a configurable retention period (new setting, e.g. usage_retention_days, with 0/empty meaning "keep forever"). Batch the delete so cron does not time out on large tables.Yes, AI was used to explore the issue.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
codeitwisely commentedComment #5
codeitwisely commented