Repository navigation
Conversation
…the cached answer expires Cost reads are cached by their time range with the policy telemetry uses, which holds a window that ended in the past for 15 minutes. A sync writes past days, so a read cached between two sync steps kept showing the half-synced window. The cached answer's key now carries when the org's sources were last written.
Maple review🟢 Confidence 10/10 · safe to merge. Cache-key-only field, verified to reach the real key, with a test that fails without it; no behavior outside cost reads changes. Cost reads now key their cached warehouse answers on the org's newest
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
What
After a cost source's first sync, the Cost page could keep showing a half-synced window for up to 15 minutes: the newest days were there, the month before was missing from the total, the filter rail and the table, while a slightly different window read correctly.
Cost reads are cached by their time range with the policy telemetry uses. That policy treats a window that ended more than 15 minutes ago as settled and holds its answer for 15 minutes, which is right for spans and wrong for cost: a sync writes past days. A source's history arrives in steps (the newest days first, older months after), so a read made between two steps was cached with part of the data and nothing changed its key.
The key now also carries when the org's cost sources were last written (the newest
updated_at, which a sync stamps at every step). A sync step shows on the next read; between syncs the cache works as before.How it was found
On the preview of #2541, with a real account: 13 minutes after the second sync step wrote October, the default window's total still covered November only. Other providers whose history arrives in steps are affected the same way on main.
Verification
cost-reads.test.tsover a cache that keeps answers by key: the same window twice computes once; after a source'supdated_atmoves, it computes again. It fails with the fix removed.cost-reads.test.ts(19) andregistry/cost.test.ts(8) pass. Typecheck: query-engine, backend, api.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.