Commit adac196
committed
deepgram-stt: report connection-lifetime remainder so usage matches billing
STTMetrics.audio_duration accumulated only the duration of audio frames
pushed to the Deepgram WebSocket via the PeriodicCollector. Deepgram
bills for the full WebSocket connection lifetime, so cost-tracking
users saw a consistent 4–5 s per-stream undercount against Deepgram's
usage reports (much worse on short calls).
Track the connection open timestamp and the total duration already
reported via _on_audio_duration_report, and on close emit any
remainder between wall-clock connection lifetime and reported frames.
The collector is also flushed before the remainder calc so pending
frame duration is accounted for first.
Fixes #54981 parent 2bb75be commit adac196
1 file changed
Lines changed: 20 additions & 0 deletions
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
413 | 418 | | |
414 | 419 | | |
415 | 420 | | |
| |||
562 | 567 | | |
563 | 568 | | |
564 | 569 | | |
| 570 | + | |
565 | 571 | | |
566 | 572 | | |
| 573 | + | |
567 | 574 | | |
568 | 575 | | |
569 | 576 | | |
| |||
593 | 600 | | |
594 | 601 | | |
595 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
596 | 615 | | |
597 | 616 | | |
598 | 617 | | |
| |||
646 | 665 | | |
647 | 666 | | |
648 | 667 | | |
| 668 | + | |
649 | 669 | | |
650 | 670 | | |
651 | 671 | | |
| |||
0 commit comments