videocall-diagnostics
A lightweight diagnostics event bus for the videocall-rs project. This crate provides a unified way to emit and collect diagnostic metrics across all subsystems in the videocall ecosystem.
⚠️ Private Crate Notice
This is a private crate that is part of the videocall-rs project and is subject to change without notice. The API is not considered stable and may undergo breaking changes between versions. This crate is not intended for external use outside of the videocall-rs ecosystem.
Features
- Cross-platform: Works on both native and WASM32 targets without requiring Tokio
- Lightweight: Minimal dependencies and overhead
- Multi-producer/multi-consumer: Uses flume channels for efficient event distribution
- Structured metrics: Type-safe metric values (i64, u64, f64, String)
- Global event bus: Easy-to-use global sender/receiver system
- Timestamped events: Automatic timestamp generation for both native and web environments
Usage in videocall-rs
This crate is used throughout the videocall-rs project to provide observability and debugging capabilities:
- videocall-client: Core client library emits connection, codec, and transport metrics
- yew-ui: Web frontend subscribes to diagnostics for real-time monitoring and debugging
- Other subsystems: Any component can emit diagnostic events for centralized collection
Basic Usage
use ;
// Emit a diagnostic event
let sender = global_sender;
let event = DiagEvent ;
sender.send.ok;
// Subscribe to all diagnostic events
let receiver = subscribe;
while let Ok = receiver.recv
Architecture
The crate provides a simple global broadcast system where:
- Producers use
global_sender()to emitDiagEventinstances - Consumers use
subscribe()to receive all future events - Events contain subsystem identification, optional stream IDs, timestamps, and structured metrics
This allows for flexible monitoring and debugging without tight coupling between components.
Dependencies
serde- Serialization support for diagnostic eventsflume- Multi-producer multi-consumer channelsjs-sys- WASM time utilities (WASM32 targets only)
Part of the videocall-rs project by Security Union LLC