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.
|
||||
const MAX_DATAPOINTS_PER_POST: usize = 1000;
|
||||
|
||||
/// `claude_code.token.usage` `type` attribute value paired with the
|
||||
/// `turn_stats` column it maps to (column index in the SELECT below).
|
||||
/// `claude_code.token.usage` `type` attribute value paired with its
|
||||
/// position in the per-row `cols` array (built in row order below).
|
||||
const TOKEN_TYPES: &[(&str, usize)] = &[
|
||||
("input", 3),
|
||||
("output", 4),
|
||||
("cacheRead", 5),
|
||||
("cacheCreation", 6),
|
||||
("input", 0),
|
||||
("output", 1),
|
||||
("cacheRead", 2),
|
||||
("cacheCreation", 3),
|
||||
];
|
||||
|
||||
/// 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.
|
||||
for &(type_, idx) in TOKEN_TYPES {
|
||||
let val = cols[idx - 3];
|
||||
for &(type_, pos) in TOKEN_TYPES {
|
||||
let val = cols[pos];
|
||||
if val <= 0 {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue