(log: Logger)
| 29 | } |
| 30 | |
| 31 | async function fetchModelStats(log: Logger): Promise<TinybirdModelStats> { |
| 32 | try { |
| 33 | const response = await fetch(TINYBIRD_MODEL_STATS_URL); |
| 34 | if (!response.ok) { |
| 35 | throw new Error(`Tinybird API error: ${response.status}`); |
| 36 | } |
| 37 | return (await response.json()) as TinybirdModelStats; |
| 38 | } catch (error) { |
| 39 | log.error("Failed to fetch model stats from Tinybird: {error}", { |
| 40 | error, |
| 41 | }); |
| 42 | return { data: [] }; |
| 43 | } |
| 44 | } |