mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Tag memory usage telemetry with the memory version (#45960)
## Why Memory usage telemetry identifies artifact kinds but does not distinguish reads from `memories` and `memories_v2`. ## What changed Return each artifact's memory version from shell command classification and add a `memory_version` tag (`v1` or `v2`) to usage counters. Normalize Windows path separators before classifying memory paths. ## Testing Extend regression coverage for both memory versions with Unix and PowerShell reads, and add a test for commands that read artifacts from both roots. GitOrigin-RevId: 68eaab3af0317613e4969e8c4e5478b18255ca52
This commit is contained in:
1 parent
7275afc5c7
commit
9b43825f23
3 files changed
+74
-32
No files matched your search
@@ -3,7 +3,8 @@ use crate::tools::context::ToolPayload;
|
||||
use crate::tools::flat_tool_name;
|
||||
use crate::tools::handlers::unified_exec::ExecCommandArgs;
|
||||
use codex_memories_read::usage::MEMORIES_USAGE_METRIC;
|
||||
use codex_memories_read::usage::memories_usage_kinds_from_command;
|
||||
use codex_memories_read::usage::memories_usage_from_command;
|
||||
use codex_protocol::MemoryVersion;
|
||||
|
||||
pub(crate) fn emit_metric_for_tool_read(invocation: &ToolInvocation, success: bool) {
|
||||
let Some(command) = shell_script_for_invocation(invocation) else {
|
||||
@@ -12,12 +13,19 @@ pub(crate) fn emit_metric_for_tool_read(invocation: &ToolInvocation, success: bo
|
||||
|
||||
let success = if success { "true" } else { "false" };
|
||||
let tool_name = flat_tool_name(&invocation.tool_name);
|
||||
for kind in memories_usage_kinds_from_command(&command) {
|
||||
for (kind, version) in memories_usage_from_command(&command) {
|
||||
invocation.turn.session_telemetry.counter(
|
||||
MEMORIES_USAGE_METRIC,
|
||||
/*inc*/ 1,
|
||||
&[
|
||||
("kind", kind.as_tag()),
|
||||
(
|
||||
"memory_version",
|
||||
match version {
|
||||
MemoryVersion::V1 => "v1",
|
||||
MemoryVersion::V2 => "v2",
|
||||
},
|
||||
),
|
||||
("tool", tool_name.as_ref()),
|
||||
("success", success),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user