Repository navigation
fix(gcp): classify commitment SKUs by usage type, not description - #253
Merged
Merged
Conversation
The Cloud SQL, Memorystore, Compute Engine and Cloud Storage price extractors decided on-demand vs commitment with a substring match on the SKU description. A committed-use SKU whose description lacks the word landed in the on-demand slot. Use Category.UsageType (OnDemand, Commit1Yr, Commit3Yr) via a shared skumatch.Slot, skip Preemptible and Spot SKUs, and return an error for a missing category or unrecognized usage type.
Contributor
|
Warning Review limit reached
This review includes 17 billable files and costs up to $4.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 4 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (17)
Comment |
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.
Closes #248
The four GCP price extractors (cloudsql, memorystore, computeengine, cloudstorage) picked the commitment slot with
strings.Contains(description, "commitment"). They now callskumatch.Slot, which readsCategory.UsageType:OnDemand-> on-demand slotCommit1Yr,Commit3Yr-> commitment slot (same last-wins behavior as before)Preemptible,Spot-> skipped (previously they were stored as on-demand)extractComputePricingFromSKUsnow returns an error, matching the other three.Test fixtures gained a
Category.UsageType. New tests cover a committed-use SKU whose description lacks "commitment" and an unknown usage type, in each service and inskumatch; they fail on main.Decision for review: the issue says to fail on an unknown usage type. I treat Preemptible and Spot as known and skip them, since erroring would break compute pricing for machine types that have Spot SKUs in the real catalog.
Follow-ups from review: Commit1Yr and Commit3Yr still share one commitment slot, last wins (pre-existing; tracked in #254). The Billing API usageType is not a documented closed enum; unknown values, including Commit1Mo, return an error by design.