mirror of
https://github.com/openai/codex.git
synced 2026-11-15 06:51:36 +00:00
Add worktree classification to thread telemetry (#43621)
## What changed Add `is_worktree` to thread initialization analytics and the `codex.thread.started` metric using validated Git repository metadata. Classify linked worktrees as `true` and primary checkouts as `false`; report an unavailable classification as `null` in analytics and `unknown` in metrics. Subagent initialization analytics leave the field unset (`null`). ## Testing Add analytics coverage for primary checkouts, linked worktrees, unknown repositories, and event serialization. Extend the account-switch telemetry test to check that the `is_worktree` tag reaches the next account's collector. GitOrigin-RevId: bc9bcd3c0212c0a123e4bcfed0c7020eef17dda6
This commit is contained in:
1 parent
c977cc0c19
commit
4b0f44d304
5 files changed
+90
-8
No files matched your search
@@ -1130,17 +1130,25 @@ impl Session {
|
||||
slug: Some(session_model),
|
||||
};
|
||||
config.features.emit_metrics(&session_telemetry);
|
||||
let is_worktree = session_configuration.cwd().canonicalize().ok().and_then(|cwd| {
|
||||
codex_git_utils::repository_identity(&cwd).and_then(|_| {
|
||||
get_git_repo_root(&cwd).map(|root| root.join(".git").is_file())
|
||||
})
|
||||
});
|
||||
let is_worktree_tag = match is_worktree {
|
||||
Some(true) => "true",
|
||||
Some(false) => "false",
|
||||
None => "unknown",
|
||||
};
|
||||
let is_git_tag = if get_git_repo_root(session_configuration.cwd()).is_some() {
|
||||
"true"
|
||||
} else {
|
||||
"false"
|
||||
};
|
||||
session_telemetry.counter(
|
||||
THREAD_STARTED_METRIC,
|
||||
/*inc*/ 1,
|
||||
&[(
|
||||
"is_git",
|
||||
if get_git_repo_root(session_configuration.cwd()).is_some() {
|
||||
"true"
|
||||
} else {
|
||||
"false"
|
||||
},
|
||||
)],
|
||||
&[("is_git", is_git_tag), ("is_worktree", is_worktree_tag)],
|
||||
);
|
||||
|
||||
let mcp_server_names =
|
||||
|
||||
Reference in new issue
Block a user