feat(#217): add regionless / region-pair sync for inter-region data transfer - #219
Merged
Conversation
…ransfer Wire up DataTransfer-InterRegion-GB, the one #217 metric left seed-only because it didn't fit the region-scoped sync. AWSDataTransfer products are catalogued globally (region="") with a distinct usagetype per source/destination region pair (e.g. USE1-APS4-AWS-Out-Bytes, transferType "InterRegion Outbound"). Two small, additive descriptor capabilities: - `query_region`: query a service's global catalogue (region="") while still storing the result under the caller's region. - `region_pair_source` (+ `usagetype_suffix`): collapse the many region-pair rows to one representative rate — keep only rows leaving the sync region (usagetype starts with its REGION_PREFIX short code) matching the suffix, drop $0 rows (Local Zones / Wavelength / same-metro), pick the modal (standard) rate, and store it once, flat, under the sync region. For us-east-1 this resolves to the standard $0.02/GB inter-region rate, matching the seed. Existing descriptors are unaffected (both keys are optional). Tests (HTTP mocked): global-region query, pair collapse to the modal rate with source-prefix / suffix / $0 exclusions, graceful no-match (0 upserts), and descriptor presence. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
elecnix
marked this pull request as ready for review
July 3, 2026 15:23
This was referenced Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #218. Wires up
DataTransfer-InterRegion-GB— the one #217 metric left seed-only because it didn't fit the region-scoped Infracost sync.The problem
AWSDataTransferproducts are catalogued globally (region="") with a distinct usagetype per source/destination region pair (e.g.USE1-APS4-AWS-Out-Bytes,transferType="InterRegion Outbound", $0.02/GB). The sync queriedregion="us-east-1"(→ 0 rows) and stored under the product's region (→""), so the metric never resolved.The mechanism (two optional, additive descriptor keys)
query_region— query a service's global catalogue (region="") while still storing under the caller's region.region_pair_source(+usagetype_suffix) — collapse the many region-pair rows to one representative rate via_upsert_region_pair_representative:REGION_PREFIXshort code) matching the suffix (-AWS-Out-Bytes),$0rows (Local Zones / Wavelength / same-metro pairs),For
us-east-1this resolves to the standard $0.02/GB inter-region rate, matching the seed. Existing descriptors are untouched (both keys are optional; default behavior unchanged).Scope note
Only
DataTransfer-InterRegion-GBis wired (its grouping was validated against the live API).DataTransfer-Internet-Out-GBandDataTransfer-InterAZ-GBremain seed-only — they use differenttransferType/usagetype groupings I haven't live-confirmed; they can adopt the same mechanism in a follow-up.Test plan (HTTP layer mocked)
query_region: ""actually queries the global catalogue (asserts postedregion == "").$0exclusions verified.Note: the AWSDataTransfer grouping (regionless,
transferType="InterRegion Outbound",<PREFIX>-<dst>-AWS-Out-Bytes) was confirmed against the live Cloud Pricing API during development; CI runs fully mocked.