Skip to content

Commit

Permalink
Add message stats to Overview
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jan 6, 2025
1 parent 0ea7cf9 commit 5dfeb35
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Display for QueueTotals {
writeln!(f, "all messages: {}", self.messages)?;
writeln!(
f,
"messages ready for dlievery: {}",
"messages ready for delivery: {}",
self.messages_ready_for_delivery
)?;
writeln!(
Expand All @@ -52,6 +52,23 @@ impl Display for QueueTotals {
}
}

impl Display for MessageStats {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(
f,
"publishing (ingress) rate: {}",
self.publishing_details.rate
)?;
writeln!(
f,
"delivery plus polling (egress) rate: {}",
self.delivery_details.rate
)?;

Ok(())
}
}

impl Display for TagList {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt_comma_separated_list(f, &self.0)
Expand Down
27 changes: 27 additions & 0 deletions src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,31 @@ pub struct QueueTotals {
pub messages_delivered_but_unacknowledged_by_consumers_details: Rate,
}

#[derive(Debug, Deserialize, Clone, PartialEq)]
#[cfg_attr(feature = "tabled", derive(Tabled))]
pub struct MessageStats {
/// Consumder delivery rate plus polling (via 'basic.get') rate
#[serde(rename = "deliver_get_details")]
pub delivery_details: Rate,
#[serde(rename = "publish_details")]
pub publishing_details: Rate,

#[serde(rename = "deliver_no_ack_details")]
pub delivery_with_automatic_acknowledgement_details: Rate,
#[serde(rename = "redeliver_details")]
pub redelivery_details: Rate,

#[serde(rename = "confirm_details")]
pub publisher_confirmation_details: Rate,
#[serde(rename = "ack_details")]
pub consumer_acknowledgement_details: Rate,

#[serde(rename = "drop_unroutable_details")]
pub unroutable_dropped_message_details: Rate,
#[serde(rename = "return_unroutable_details")]
pub unroutable_returned_message_details: Rate,
}

#[derive(Debug, Deserialize, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "tabled", derive(Tabled))]
pub struct Listener {
Expand Down Expand Up @@ -1045,8 +1070,10 @@ pub struct Overview {

pub statistics_db_event_queue: u64,
pub churn_rates: ChurnRates,

pub queue_totals: QueueTotals,
pub object_totals: ObjectTotals,
pub message_stats: MessageStats,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
Expand Down

0 comments on commit 5dfeb35

Please sign in to comment.