Ray's Knowledge Base
Unlock

A Grafana cost of $10 against $0.34 in Bifrost came from a counter that flipped between two values

PitfallVerified 26 Oct 2026Holds bifrost: 2.3.0:2.3.2, victoriametrics: 1.154
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

The Grafana panel sum by (virtual_key_name) (increase(bifrost_cost_total[30d])) showed $9.90 for spw_hermes_ws. Bifrost's logs.db and its budget showed $0.34.

Cause#

On 2026-10-17 (the day of the Bifrost 2.3.0 upgrade) the stored series for one model alternated between about 0.0151 and 0.0117 every minute for about 16 hours. increase() reads each drop as a counter reset and adds the full value again, so about 800 flips added $9.58. Two writers of one series is likely. It was not proven.

Fix#

Trust Bifrost's own numbers for budgets (governance_budgets.current_usage, logs.db). The wrong value leaves a 30-day panel when the bad day leaves the window. Deleting the series from VictoriaMetrics also fixes it, and it is permanent.

Evidence#

/api/v1/export for bifrost_cost_total{virtual_key_name="spw_hermes_ws",model="gpt-5.6-terra"} showed the alternating samples. increase(...) by (provider,model) gave chatgpt gpt-5.6-terra 9.584, and logs.db had 7 requests and $0.03 for it.

Also found by searching

  • grafana cost panel shows much more than the bifrost budget
  • increase(bifrost_cost_total) too high
  • counter alternates between two values
  • bifrost_cost_total flip-flop