pub struct PerformanceMetrics {
pub total_calls: usize,
pub calls_answered: usize,
pub calls_queued: usize,
pub calls_abandoned: usize,
pub average_wait_time_ms: u64,
pub average_handle_time_ms: u64,
pub service_level_percentage: f32,
pub start_time: DateTime<Utc>,
pub end_time: DateTime<Utc>,
}
Expand description
Performance metrics for a specified time period
Comprehensive call center performance data including call volumes, service levels, timing metrics, and quality indicators. This structure provides the foundation for performance reporting and analysis.
§Metrics Included
§Volume Metrics
- Total Calls: All inbound calls received
- Calls Answered: Calls successfully connected to agents
- Calls Queued: Calls that entered queue systems
- Calls Abandoned: Calls disconnected before being answered
§Timing Metrics
- Average Wait Time: Mean time customers wait in queues
- Average Handle Time: Mean time agents spend on calls
- Service Level: Percentage of calls answered within target time
§Examples
§Performance Analysis
use rvoip_call_engine::api::supervisor::{SupervisorApi, PerformanceMetrics};
use chrono::{Utc, Duration};
let supervisor = SupervisorApi::new(engine);
let end_time = Utc::now();
let start_time = end_time - Duration::hours(1);
let metrics = supervisor.get_performance_metrics(start_time, end_time).await;
// Calculate derived metrics
let answer_rate = if metrics.total_calls > 0 {
metrics.calls_answered as f32 / metrics.total_calls as f32 * 100.0
} else {
0.0
};
let abandon_rate = if metrics.total_calls > 0 {
metrics.calls_abandoned as f32 / metrics.total_calls as f32 * 100.0
} else {
0.0
};
println!("📊 Performance Analysis:");
println!(" Answer Rate: {:.1}%", answer_rate);
println!(" Abandon Rate: {:.1}%", abandon_rate);
println!(" Service Level: {:.1}%", metrics.service_level_percentage);
// Performance targets
if answer_rate < 90.0 {
println!("🚨 Answer rate below 90% target");
}
if abandon_rate > 5.0 {
println!("⚠️ Abandon rate above 5% target");
}
if metrics.service_level_percentage < 80.0 {
println!("📉 Service level below 80% target");
}
Fields§
§total_calls: usize
Total number of calls received in the period
calls_answered: usize
Number of calls successfully answered by agents
calls_queued: usize
Number of calls that entered queue systems
calls_abandoned: usize
Number of calls abandoned before being answered
average_wait_time_ms: u64
Average wait time in queues (milliseconds)
average_handle_time_ms: u64
Average call handling time (milliseconds)
service_level_percentage: f32
Service level percentage (calls answered within target time)
start_time: DateTime<Utc>
Start of the measurement period
end_time: DateTime<Utc>
End of the measurement period
Trait Implementations§
Source§impl Clone for PerformanceMetrics
impl Clone for PerformanceMetrics
Source§fn clone(&self) -> PerformanceMetrics
fn clone(&self) -> PerformanceMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for PerformanceMetrics
impl RefUnwindSafe for PerformanceMetrics
impl Send for PerformanceMetrics
impl Sync for PerformanceMetrics
impl Unpin for PerformanceMetrics
impl UnwindSafe for PerformanceMetrics
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more