Watch
0
0
Fork
You've already forked hyperhive
0

export an open-todos gauge and chart it on the agent dashboard

This commit is contained in:
atlas 2026-11-01 15:08:27 +01:00 • committed by mara
commit 08b8eb3f73

View file

@ -52,6 +52,9 @@ struct Instruments {
session_count: Counter<u64>,
open_threads: Gauge<u64>,
open_reminders: Gauge<u64>,
/// Recorded from [`crate::todos_gauge`]'s own tick: todos change between
/// turns.
open_todos: Gauge<u64>,
/// Recorded from [`crate::claude_md_watch`]'s own tick, not from
/// [`record`] — `AGENTS.md` size is a continuously-live value (like
/// hive-c0re's container gauges), not a once-per-turn one, so it has
@ -133,6 +136,15 @@ pub fn record_subagent_role_lines(role: String, lines: u64) {
.record(lines, &[KeyValue::new("role", role)]);
}
/// Record the number of open todos. No-op when OTEL isn't configured, same
/// as [`record`].
pub fn record_open_todos(count: u64) {
let Some(inst) = INSTRUMENTS.get_or_init(build).as_ref() else {
return;
};
inst.open_todos.record(count, &[]);
}
/// Record one subscription usage window (`five_hour`, `seven_day`, …):
/// `percent` is 0-100, `resets_at` unix seconds. No-op when OTEL isn't
/// configured, same as [`record`].
@ -195,6 +207,7 @@ fn build() -> Option<Instruments> {
open_reminders: meter
.u64_gauge("hyperhive.agent.loose_ends.reminders")
.build(),
open_todos: meter.u64_gauge("hyperhive.agent.todos.open").build(),
claude_md_lines: meter.u64_gauge("hyperhive.agent.claude_md.lines").build(),
subagent_role_lines: meter
.u64_gauge("hyperhive.agent.subagent_role.lines")