Skip to content

Commit ed02c1c

Browse files
pblazejclaude
andcommitted
feat(telemetry): Display for TelemetryStats, diagnostics() over UniFFI
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 646462c commit ed02c1c

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

livekit-telemetry/src/stats.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,31 @@ pub struct TelemetryStats {
196196
pub cached_batches: u64,
197197
}
198198

199+
/// One line for a debug console.
200+
impl std::fmt::Display for TelemetryStats {
201+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
202+
write!(
203+
f,
204+
"telemetry: sent {} ({} B), cached {}, failed {}, timeouts {}, holds capped {}, dropped {} \
205+
(queue {}, cache {}/{}, rejected {}, throttled {}, rate-limited {}, disabled {})",
206+
self.uploads_sent,
207+
self.upload_bytes,
208+
self.cached_batches,
209+
self.upload_failures,
210+
self.upload_timeouts,
211+
self.holds_capped,
212+
self.dropped,
213+
self.dropped_queue_full,
214+
self.dropped_cache_full,
215+
self.dropped_cache_error,
216+
self.dropped_rejected,
217+
self.dropped_throttled,
218+
self.dropped_rate_limited,
219+
self.dropped_disabled,
220+
)
221+
}
222+
}
223+
199224
impl TelemetryStats {
200225
pub(crate) fn new(snapshot: Snapshot, cached_batches: u64) -> Self {
201226
Self {

livekit-uniffi/src/telemetry.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ impl Telemetry {
141141
pub fn stats(&self) -> TelemetryStats {
142142
self.0.stats()
143143
}
144+
145+
/// The stats as one line for a debug console.
146+
pub fn diagnostics(&self) -> String {
147+
self.inner.stats().to_string()
148+
}
144149
}
145150

146151
/// One room's session on the process pipeline: what its spans, stats and events are filed

0 commit comments

Comments
 (0)