Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code: log more data from characters logger #5931

Merged
merged 3 commits into from
Oct 18, 2024
Merged

Conversation

valerybugakov
Copy link
Member

@valerybugakov valerybugakov commented Oct 17, 2024

Updated CharacterLogger to gain more insights into the unexpectedly high number of insertions that affect our metrics.

  • Group document changes by size.
  • Rely on vscode.window.activeTextEditor to track edits from the active window.
  • Rely on activeTextEditor.visibleRanges to mark edits as outside of the viewport.
  • There's no way to detect if the active text editor is focused using the VS Code API. Here's the GitHub issue where I asked for updates. It means we cannot reliably detect cases where users switched to the integrated terminal window or to the sidebar where they can perform actions that would result in a high number of insertions/deletions (e.g., by interactive with version control CLI or UI).
  • To gain more information about such changes we group edits by document selection staleness (if the cursor didn't move for the last 5 seconds) and by the speed of changes (mark them as rapid if they occurred in less than 15 ms which is the threshold I got from local testing find-and-replace/refactor commands).
  • Follow up for VS Code: improve characters logger #5855

The new cody.characters telemetry event structure:

{
  "undo_inserted": 0,
  "undo_deleted": 0,
  "undo": 0,
  "redo_inserted": 0,
  "redo_deleted": 0,
  "redo": 0,
  "window_not_focused_inserted": 0,
  "window_not_focused_deleted": 0,
  "window_not_focused": 0,
  "no_active_editor_inserted": 0,
  "no_active_editor_deleted": 0,
  "no_active_editor": 0,
  "outside_of_active_editor_inserted": 0,
  "outside_of_active_editor_deleted": 0,
  "outside_of_active_editor": 0,
  "outside_of_visible_ranges_inserted": 5,
  "outside_of_visible_ranges_deleted": 0,
  "outside_of_visible_ranges": 0,
  "unexpected_inserted": 0,
  "unexpected_deleted": 0,
  "unexpected": 0,
  "xxxs_change_inserted": 0,
  "xxxs_change_deleted": 0,
  "xxxs_change": 0,
  "xxs_change_inserted": 0,
  "xxs_change_deleted": 0,
  "xxs_change": 1,
  "xs_change_inserted": 0,
  "xs_change_deleted": 0,
  "xs_change": 0,
  "s_change_inserted": 0,
  "s_change_deleted": 0,
  "s_change": 0,
  "m_change_inserted": 0,
  "m_change_deleted": 0,
  "m_change": 0,
  "l_change_inserted": 0,
  "l_change_deleted": 0,
  "l_change": 0,
  "xl_change_inserted": 0,
  "xl_change_deleted": 0,
  "xl_change": 0,
  "xxl_change_inserted": 0,
  "xxl_change_deleted": 0,
  "xxl_change": 0,
  "xxxl_change_inserted": 0,
  "xxxl_change_deleted": 0,
  "xxxl_change": 0,
  "stale_xxxs_change_inserted": 0,
  "stale_xxxs_change_deleted": 0,
  "stale_xxxs_change": 0,
  "rapid_xxxs_change_inserted": 0,
  "rapid_xxxs_change_deleted": 0,
  "rapid_xxxs_change": 0,
  "rapid_stale_xxxs_change_inserted": 0,
  "rapid_stale_xxxs_change_deleted": 0,
  "rapid_stale_xxxs_change": 0,
  "stale_xxs_change_inserted": 0,
  "stale_xxs_change_deleted": 0,
  "stale_xxs_change": 0,
  "rapid_xxs_change_inserted": 0,
  "rapid_xxs_change_deleted": 0,
  "rapid_xxs_change": 0,
  "rapid_stale_xxs_change_inserted": 0,
  "rapid_stale_xxs_change_deleted": 0,
  "rapid_stale_xxs_change": 0,
  "stale_xs_change_inserted": 0,
  "stale_xs_change_deleted": 0,
  "stale_xs_change": 0,
  "rapid_xs_change_inserted": 0,
  "rapid_xs_change_deleted": 0,
  "rapid_xs_change": 0,
  "rapid_stale_xs_change_inserted": 0,
  "rapid_stale_xs_change_deleted": 0,
  "rapid_stale_xs_change": 0,
  "stale_s_change_inserted": 0,
  "stale_s_change_deleted": 0,
  "stale_s_change": 0,
  "rapid_s_change_inserted": 0,
  "rapid_s_change_deleted": 0,
  "rapid_s_change": 0,
  "rapid_stale_s_change_inserted": 0,
  "rapid_stale_s_change_deleted": 0,
  "rapid_stale_s_change": 0,
  "stale_m_change_inserted": 0,
  "stale_m_change_deleted": 0,
  "stale_m_change": 0,
  "rapid_m_change_inserted": 0,
  "rapid_m_change_deleted": 0,
  "rapid_m_change": 0,
  "rapid_stale_m_change_inserted": 0,
  "rapid_stale_m_change_deleted": 0,
  "rapid_stale_m_change": 0,
  "stale_l_change_inserted": 0,
  "stale_l_change_deleted": 0,
  "stale_l_change": 0,
  "rapid_l_change_inserted": 0,
  "rapid_l_change_deleted": 0,
  "rapid_l_change": 0,
  "rapid_stale_l_change_inserted": 0,
  "rapid_stale_l_change_deleted": 0,
  "rapid_stale_l_change": 0,
  "stale_xl_change_inserted": 0,
  "stale_xl_change_deleted": 0,
  "stale_xl_change": 0,
  "rapid_xl_change_inserted": 0,
  "rapid_xl_change_deleted": 0,
  "rapid_xl_change": 0,
  "rapid_stale_xl_change_inserted": 0,
  "rapid_stale_xl_change_deleted": 0,
  "rapid_stale_xl_change": 0,
  "stale_xxl_change_inserted": 0,
  "stale_xxl_change_deleted": 0,
  "stale_xxl_change": 0,
  "rapid_xxl_change_inserted": 0,
  "rapid_xxl_change_deleted": 0,
  "rapid_xxl_change": 0,
  "rapid_stale_xxl_change_inserted": 0,
  "rapid_stale_xxl_change_deleted": 0,
  "rapid_stale_xxl_change": 0,
  "stale_xxxl_change_inserted": 0,
  "stale_xxxl_change_deleted": 0,
  "stale_xxxl_change": 0,
  "rapid_xxxl_change_inserted": 0,
  "rapid_xxxl_change_deleted": 0,
  "rapid_xxxl_change": 0,
  "rapid_stale_xxxl_change_inserted": 0,
  "rapid_stale_xxxl_change_deleted": 0,
  "rapid_stale_xxxl_change": 0
}

Test plan

CI and updated unit tests

@valerybugakov valerybugakov marked this pull request as ready for review October 18, 2024 10:13
@valerybugakov valerybugakov enabled auto-merge (squash) October 18, 2024 10:15
@valerybugakov valerybugakov merged commit e5879e4 into main Oct 18, 2024
42 checks passed
@valerybugakov valerybugakov deleted the vb/chars-logger2 branch October 18, 2024 17:45
valerybugakov added a commit that referenced this pull request Oct 19, 2024
Updated `CharacterLogger` to gain more insights into the unexpectedly
high number of insertions that affect our metrics.

- Group document changes by size.
- Rely on `vscode.window.activeTextEditor` to track edits from the
active window.
- Rely on `activeTextEditor.visibleRanges` to mark edits as outside of
the viewport.
- There's no way to detect if the active text editor is focused using
the VS Code API. Here's [the GitHub
issue](microsoft/vscode#117980) where I asked
for updates. It means we cannot reliably detect cases where users
switched to the integrated terminal window or to the sidebar where they
can perform actions that would result in a high number of
insertions/deletions (e.g., by interactive with version control CLI or
UI).
- To gain more information about such changes we group edits by document
selection staleness (if the cursor didn't move for the last 5 seconds)
and by the speed of changes (mark them as rapid if they occurred in less
than 15 ms which is the threshold I got from local testing
find-and-replace/refactor commands).
valerybugakov added a commit that referenced this pull request Oct 19, 2024
Patch release v1.38.2 with character logger improvements:
- #5931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants