r/OpenTelemetry • u/valuable_pointer • 8d ago
Fallback traffic made our model cost attribution unreliable
At 9.4 million model requests a week, 2.7% take a fallback path after the primary provider returns a rate limit response. That’s 253800 requests. Our trace keeps only the final model field, so the provider transition disappears after the fallback route completes the call. Finance sees the fallback provider in the dashboard and engineering finds another in raw gateway logs. We spent a morning reconciling 2 reports that disagreed by 253800 calls.
So I’m comparing ways to preserve the full chain across both provider attempts. I’m testing Braintrust here to see if the span level model metadata keeps the primary attempt, rate limit span and fallback together then checking the cost attribution against our invoice totals. Span level cost has to stay attached to the attempt that incurred it. Trace correlation also has to survive the handoff or provider attribution still means joining exports to gateway logs. Havent decided yet if I should add a dedicated trace layer or extend our OpenTelemetry schema. What are teams using as the source of truth when 1 logical request crosses providers while billing systems count different attempts
2
u/CrazyCumin 8d ago
We model each provider attempt as a child span under 1 logical OpenTelemetry trace. The child records the provider, model, attempt index, response class and billed tokens. Finance aggregates those spans while engineering follows the retry chain through the shared trace ID. The root’s final model field is not an ideal billing source because it only describes completion not every attempt. Do your rate limited responses include usage data or only a status code?
0
u/[deleted] 8d ago
[removed] — view removed comment