Skip to main content

parse_grok_billing

Function parse_grok_billing 

Source
pub fn parse_grok_billing(
    body: &str,
    account_label: &str,
    observed_at: u64,
) -> Result<UsageSnapshot, UsageError>
Expand description

Parse GET /v1/billing?format=credits.

Recognized: config.creditUsagePercent (preferred), else onDemandUsed.val / onDemandCap.val * 100; reset from config.currentPeriod.end or config.billingPeriodEnd; duration from billingPeriodMinutes. Each field is also accepted at the root. Without a recognizable fraction the window is explicitly Unknown.