Commit 7a52f24
committed
refactor: handle metrics extraction failures gracefully
Move the metrics_extractor call inside _track_from_metrics_extractor
so extraction errors are caught and logged without bubbling up. When
extraction fails or returns None, only the wall-clock duration is
tracked — success/error is left untouched since the underlying model
call itself succeeded.
Also tighten the tool_calls check to access metrics.tool_calls
directly, mirroring how metrics.usage is accessed.1 parent 89d0ad7 commit 7a52f24
1 file changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
283 | 298 | | |
284 | 299 | | |
285 | 300 | | |
| |||
288 | 303 | | |
289 | 304 | | |
290 | 305 | | |
291 | | - | |
| 306 | + | |
292 | 307 | | |
293 | 308 | | |
294 | 309 | | |
| |||
326 | 341 | | |
327 | 342 | | |
328 | 343 | | |
329 | | - | |
330 | | - | |
| 344 | + | |
331 | 345 | | |
332 | 346 | | |
333 | 347 | | |
| |||
355 | 369 | | |
356 | 370 | | |
357 | 371 | | |
358 | | - | |
359 | | - | |
| 372 | + | |
360 | 373 | | |
361 | 374 | | |
362 | 375 | | |
| |||
0 commit comments