fix(#1974): pair token cols by array position (argus review)
This commit is contained in:
parent
5393f0e7d4
commit
a94fb9955f
1 changed files with 8 additions and 8 deletions
|
|
@ -42,13 +42,13 @@ const TERMINAL_TYPE: &str = "non-interactive";
|
||||||
/// into reasonably-sized OTLP requests rather than one huge body.
|
/// into reasonably-sized OTLP requests rather than one huge body.
|
||||||
const MAX_DATAPOINTS_PER_POST: usize = 1000;
|
const MAX_DATAPOINTS_PER_POST: usize = 1000;
|
||||||
|
|
||||||
/// `claude_code.token.usage` `type` attribute value paired with the
|
/// `claude_code.token.usage` `type` attribute value paired with its
|
||||||
/// `turn_stats` column it maps to (column index in the SELECT below).
|
/// position in the per-row `cols` array (built in row order below).
|
||||||
const TOKEN_TYPES: &[(&str, usize)] = &[
|
const TOKEN_TYPES: &[(&str, usize)] = &[
|
||||||
("input", 3),
|
("input", 0),
|
||||||
("output", 4),
|
("output", 1),
|
||||||
("cacheRead", 5),
|
("cacheRead", 2),
|
||||||
("cacheCreation", 6),
|
("cacheCreation", 3),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Datapoints collected from one agent's stats db, split by metric.
|
/// Datapoints collected from one agent's stats db, split by metric.
|
||||||
|
|
@ -201,8 +201,8 @@ fn collect_agent_points(db: &Path, id_prefix: &str) -> Result<AgentPoints> {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// token.usage: per (type, model, session.id) running total.
|
// token.usage: per (type, model, session.id) running total.
|
||||||
for &(type_, idx) in TOKEN_TYPES {
|
for &(type_, pos) in TOKEN_TYPES {
|
||||||
let val = cols[idx - 3];
|
let val = cols[pos];
|
||||||
if val <= 0 {
|
if val <= 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue