Observability #6

Merged
qpismont merged 6 commits from 1.1 into main 2026-07-26 21:55:42 +02:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit e1cb5d7d96 - Show all commits
+1 -1
View File
@@ -46,7 +46,7 @@ pub async fn exec_review(
review_result.cost = chat_result.cost; review_result.cost = chat_result.cost;
if let Some(cost) = review_result.cost { if let Some(cost) = review_result.cost {
metrics::openrouter_cost_usd((cost / 100.0).round() as u64); metrics::openrouter_cost_usd(cost);
} }
let final_review_markdown = review_result_to_markdown(&review_result); let final_review_markdown = review_result_to_markdown(&review_result);
+3 -3
View File
@@ -35,8 +35,8 @@ pub fn task_failed(event_type: &str) {
.increment(1); .increment(1);
} }
pub fn openrouter_cost_usd(cost: u64) { pub fn openrouter_cost_usd(cost: f64) {
counter!("herald_openrouter_cost_usd_total").increment(cost); counter!("herald_openrouter_cost_cents_total").increment((cost * 100.0).round() as u64);
} }
pub fn describe() { pub fn describe() {
@@ -46,7 +46,7 @@ pub fn describe() {
describe_gauge!("herald_bot_tasks_active", Unit::Count, "Bot tasks currently in progress"); 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_completed_total", Unit::Count, "Bot tasks completed successfully");
describe_counter!("herald_bot_tasks_failed_total", Unit::Count, "Bot tasks that failed"); describe_counter!("herald_bot_tasks_failed_total", Unit::Count, "Bot tasks that failed");
describe_counter!("herald_openrouter_cost_usd_total", Unit::Count, "Total OpenRouter cost in USD"); 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<()> { pub fn install(bind_addr: &str) -> anyhow::Result<()> {