@@ -1,10 +1,9 @@
|
||||
use std::{net::SocketAddr, str::FromStr};
|
||||
|
||||
use metrics::{Unit, describe_counter, describe_gauge, counter, gauge};
|
||||
use metrics::{Unit, counter, describe_counter, describe_gauge, gauge};
|
||||
|
||||
pub fn webhook_received(event_type: &str) {
|
||||
counter!("herald_webhooks_received_total", "event_type" => event_type.to_string())
|
||||
.increment(1);
|
||||
counter!("herald_webhooks_received_total", "event_type" => event_type.to_string()).increment(1);
|
||||
}
|
||||
|
||||
pub fn webhook_duplicate(event_type: &str) {
|
||||
@@ -31,8 +30,7 @@ pub fn task_completed(event_type: &str) {
|
||||
}
|
||||
|
||||
pub fn task_failed(event_type: &str) {
|
||||
counter!("herald_bot_tasks_failed_total", "event_type" => event_type.to_string())
|
||||
.increment(1);
|
||||
counter!("herald_bot_tasks_failed_total", "event_type" => event_type.to_string()).increment(1);
|
||||
}
|
||||
|
||||
pub fn openrouter_cost_usd(cost: f64) {
|
||||
@@ -40,13 +38,41 @@ pub fn openrouter_cost_usd(cost: f64) {
|
||||
}
|
||||
|
||||
pub fn describe() {
|
||||
describe_counter!("herald_webhooks_received_total", Unit::Count, "Total webhooks received");
|
||||
describe_counter!("herald_webhooks_duplicate_total", Unit::Count, "Webhooks rejected as duplicates");
|
||||
describe_counter!("herald_webhooks_channel_full_total", Unit::Count, "Webhooks dropped because the bot channel was full");
|
||||
describe_gauge!("herald_bot_tasks_active", Unit::Count, "Bot tasks currently in progress");
|
||||
describe_counter!("herald_bot_tasks_completed_total", Unit::Count, "Bot tasks completed successfully");
|
||||
describe_counter!("herald_bot_tasks_failed_total", Unit::Count, "Bot tasks that failed");
|
||||
describe_counter!("herald_openrouter_cost_cents_total", Unit::Count, "Total OpenRouter cost in cents (divide by 100 for USD)");
|
||||
describe_counter!(
|
||||
"herald_webhooks_received_total",
|
||||
Unit::Count,
|
||||
"Total webhooks received"
|
||||
);
|
||||
describe_counter!(
|
||||
"herald_webhooks_duplicate_total",
|
||||
Unit::Count,
|
||||
"Webhooks rejected as duplicates"
|
||||
);
|
||||
describe_counter!(
|
||||
"herald_webhooks_channel_full_total",
|
||||
Unit::Count,
|
||||
"Webhooks dropped because the bot channel was full"
|
||||
);
|
||||
describe_gauge!(
|
||||
"herald_bot_tasks_active",
|
||||
Unit::Count,
|
||||
"Bot tasks currently in progress"
|
||||
);
|
||||
describe_counter!(
|
||||
"herald_bot_tasks_completed_total",
|
||||
Unit::Count,
|
||||
"Bot tasks completed successfully"
|
||||
);
|
||||
describe_counter!(
|
||||
"herald_bot_tasks_failed_total",
|
||||
Unit::Count,
|
||||
"Bot tasks that failed"
|
||||
);
|
||||
describe_counter!(
|
||||
"herald_openrouter_cost_cents_total",
|
||||
Unit::Count,
|
||||
"Total OpenRouter cost in cents (divide by 100 for USD)"
|
||||
);
|
||||
}
|
||||
|
||||
pub fn install(bind_addr: &str) -> anyhow::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user