hive-agent: no hard-coded context window sizes, the window is what the API reports
This commit is contained in:
parent
4a109fa038
commit
1bfee54414
1 changed files with 47 additions and 124 deletions
|
|
@ -273,15 +273,18 @@ pub fn record_swarm_queue_publish_skipped(site: &'static str) {
|
|||
.add(1, &[KeyValue::new("site", site)]);
|
||||
}
|
||||
|
||||
/// Record the context window's fill at turn end: `used` tokens of `size`,
|
||||
/// the two numbers the web UI's ctx% divides. No-op when OTEL isn't
|
||||
/// configured, same as [`record`].
|
||||
pub fn record_context(used: u64, size: u64) {
|
||||
/// Record the context window's fill at turn end: `used` tokens, and the
|
||||
/// window's `size` once the API has reported one (until then there is nothing
|
||||
/// to divide by, so no size is recorded rather than a guessed one). No-op when
|
||||
/// OTEL isn't configured, same as [`record`].
|
||||
pub fn record_context(used: u64, size: Option<u64>) {
|
||||
let Some(inst) = INSTRUMENTS.get_or_init(build).as_ref() else {
|
||||
return;
|
||||
};
|
||||
inst.context_used.record(used, &[]);
|
||||
inst.context_size.record(size, &[]);
|
||||
if let Some(size) = size {
|
||||
inst.context_size.record(size, &[]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Add what an ACP agent reported spending since the last call. No-op when
|
||||
|
|
|
|||
Loading…
Reference in a new issue