-
[OPIK-7231] [BE] feat: ingest cipx spend blocks into dedicated table with derived allocation (#7392)
发布于
2026-07-08 10:05:36 +00:00 - [OPIK-7231] [BE] feat: ingest cipx spend blocks into dedicated table with derived allocation
Retrieval used to ARRAY JOIN cipx_spends.blocks (~363 blocks/span) and re-derive
per-span token allocation with window functions on every request. Ingestion now
writes one row per block into the new cipx_spend_blocks table with the derived
columns (tier, lane, bd_lane, label, is_definition, alloc) computed once in Java,
plus residual rows for billed tiers no block absorbs, so retrieval becomes plain
GROUP BYs. block_idx (raw array position; 65531 + tier ordinal for residuals)
keeps the ReplacingMergeTree key unique and replay-deduplicable.- drop cipx_spends.blocks (000097); create cipx_spend_blocks (000098)
- recreate cipx_trace_identities with user_uuid in the sorting key (000099)
- new MySQL cipx_user_mappings (000088), populated from trace identity on
create and update, for email -> user_uuid resolution at retrieval - span ingestion is create-only (cipx call data is immutable): drop
SpanCostIntelligenceChanged and the span-update resolve path; the trace
identity update path stays
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
-
refactor
-
increment migration version
-
refactor(cipx): add builder to UserMapping per review
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
-
refactor
-
address comments
下载附件