Public BetaSpend trackers are currently in a Public Beta. Breaking changes may occur between now and GA. Please contact your Metronome representative for access.
spend_tracker on the contract to track the total spend for specific charges over time.
Create a spend tracker
Spend trackers return the summation of specified charges over a period of time -spend_tracker.reset_frequency. Spend trackers can be set on Package creation, contract creation, or contract edit. Other configurations on the contract can point at the spend tracker to manage spend based thresholds. For example, we can create a spend tracker to cap the amount of discounted prepaid commit purchases a customer can get in a single month.
applicable_spend_specifiers specify which charges should count against the spend tracker:
spend_type: Today, only commit purchases can count towards a spend tracker.sources: Specify whether commits created manually and / or threshold billing commits count towards the spend tracker.discounted: Optionally specify whether commits marked as “discounted” count towards the spend tracker. For manual commits, this is defined viaspend_tracker_attributes.count_as_discounted. For threshold billing commits, it is defined via thediscount_config.
discount_config on the prepaid_balance_threshold_configuration points at this spend tracker to enforce a cap. When the cap is reached, new threshold commits will not be discounted until the start of the next billing period.