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;
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);
+3 -3
View File
@@ -35,8 +35,8 @@ pub fn task_failed(event_type: &str) {
.increment(1);
}
pub fn openrouter_cost_usd(cost: u64) {
counter!("herald_openrouter_cost_usd_total").increment(cost);
pub fn openrouter_cost_usd(cost: f64) {
qpismont marked this conversation as resolved Outdated
Outdated
Review

La métrique herald_openrouter_cost_usd_total utilise un compteur de type Count, mais elle représente un coût en dollars. Bien que cela soit fonctionnel, il serait plus clair d'utiliser un type Gauge ou d'ajouter une unité personnalisée si possible. Actuellement l'unité Count peut prêter à confusion pour les opérateurs.

La métrique `herald_openrouter_cost_usd_total` utilise un compteur de type `Count`, mais elle représente un coût en dollars. Bien que cela soit fonctionnel, il serait plus clair d'utiliser un type `Gauge` ou d'ajouter une unité personnalisée si possible. Actuellement l'unité `Count` peut prêter à confusion pour les opérateurs.
counter!("herald_openrouter_cost_cents_total").increment((cost * 100.0).round() as u64);
}
pub fn describe() {
@@ -46,7 +46,7 @@ pub fn describe() {
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_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<()> {