-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Summary
The current price calculation logic in rustcost-core works for basic scenarios but lacks the precision needed for more complex or cloud-aligned cost models. Improving the calculation engine will ensure more reliable outputs and better alignment with real-world billing structures.
Problem
Some pricing formulas are overly simplified, do not account for edge cases, or don't match how cloud providers calculate usage-based costs. This can lead to inaccuracies when modeling workloads with varying compute, storage, or network characteristics.
Goals
Refine the internal cost computation logic to improve accuracy.
Support more granular pricing components (e.g., per-GB, per-request, per-CPU-hour).
Handle tiered, variable, or region-specific pricing more correctly.
Improve numeric precision and rounding behavior.
Proposed Improvements
Introduce a more modular calculation pipeline to support complex pricing structures.
Add validation for intermediate calculation values.
Improve unit conversions (e.g., MiB ↔ GB, seconds ↔ hours).
Add test cases covering edge scenarios and multi-factor cost formulas.
Document the calculation model to ensure consistency across crates.
Expected Benefits
More accurate and reliable cost outputs.
Consistent results between UI, dashboard, and core engine.
Foundation for future cloud-provider-specific pricing models.
Notes
These improvements should remain backward compatible with existing APIs but allow future extensions such as spot pricing, tiered billing, and usage-based modifiers.