(tier: GranularityTier)
| 408 | case 'outputInputRatio': |
| 409 | return 'CASE WHEN COALESCE(SUM(total_input_tokens), 0) = 0 THEN 0 ELSE COALESCE(SUM(total_output_tokens), 0)::FLOAT / SUM(total_input_tokens)::FLOAT END'; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | function generationTimeCountExprSql(tier: GranularityTier): string { |
| 414 | if (tier === 'hourly') { |
| 415 | return 'IFF(total_generation_time_ms IS NOT NULL, 1, 0)'; |
| 416 | } |
| 417 | // Daily rollups do not currently carry a generation-time observation count. |
| 418 | // Derive one only for the window backed by hourly rollups so older daily |
| 419 | // history does not reuse latency_count as an incorrect denominator. |
| 420 | return 'IFF(total_generation_time_ms IS NOT NULL AND usage_date >= DATEADD(day, -7, CURRENT_DATE), 1, 0)'; |
| 421 | } |
no outgoing calls
no test coverage detected