Skip to content

Update telemetry for code review over remote sessions#11484

Merged
MaggieShan merged 7 commits into
masterfrom
maggs/remote-server-code-review-telem
May 21, 2026
Merged

Update telemetry for code review over remote sessions#11484
MaggieShan merged 7 commits into
masterfrom
maggs/remote-server-code-review-telem

Conversation

@MaggieShan
Copy link
Copy Markdown
Contributor

@MaggieShan MaggieShan commented May 21, 2026

Description

  • Wires is_local through existing code review view events
    • Some(true) => local, Some(false) => remote, None => no repo
  • Moves event emission to code review for access to repo path
  • Tracks load diff latency
  • Emits events for decode or empty errors

Testing

Verified by running locally with_sandbox_telemetry

Agent mode

  • Warp Agent Mode

@cla-bot cla-bot Bot added the cla-signed label May 21, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 21, 2026

@MaggieShan

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@MaggieShan MaggieShan changed the title Fix DCS/OSC termination characters in bootstrap scripts Update telemetry for code review over remote sessions May 21, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds an is_local telemetry dimension across code review events, moves editor-scoped comment/revert telemetry emission up to the code review view so repo locality is available, and adds a diff-load completion event with aggregate diff metadata.

Concerns

  • No blocking correctness concerns found in the changed lines.
  • Security pass found no issues; the new telemetry fields are limited to local/remote classification and aggregate counts/status values.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@MaggieShan MaggieShan requested a review from kevinyang372 May 21, 2026 17:59
Comment thread app/src/ai/agent/conversation.rs Outdated
}
RevertDiffHunk { line_range } => {
if FeatureFlag::RevertDiffHunk.is_enabled() {
send_telemetry_from_ctx!(CodeReviewTelemetryEvent::RevertHunkClicked, ctx);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


impl CodeEditorModel {
pub fn open_comment_line(&mut self, line: &EditorLineLocation, ctx: &mut ModelContext<Self>) {
// Telemetry: comment editor opened for a new inline review comment.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we refactoring the CommentEditorOpened event?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving it so it's instead emitted from the code review view so we have access to the is_local field

Comment thread app/src/code_review/diff_state/local.rs Outdated
Comment thread app/src/code_review/diff_state/local.rs Outdated
@@ -215,6 +216,14 @@ impl RemoteDiffStateModel {
Ok((metadata, state, diffs)) => self.apply_snapshot(metadata, state, diffs, ctx),
Err(error) => {
log::warn!("RemoteDiffStateModel: invalid diff state snapshot: {error}");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually instead of logging telemetry, would it make more sense to make this warn statement log::error so we could track these in sentry?

One thing we should do a pass on is the message here doesn't contain PII or IDs (e.g. Session ID)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point - can confirm that the error message themselves don't include any PII and mainly come from the try_from fns that send static strings. Updated to send error logs with safe_error! instead of telemetry events

Comment thread app/src/code_review/code_review_view.rs Outdated
/// Timestamp captured when a diff load is initiated. Cleared when the
/// corresponding `DiffLoadCompleted` telemetry event is emitted, so the
/// elapsed time between request and completion can be reported.
diff_load_start_time: Option<Instant>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting this on the overall CodeReviewView struct, should it belong to InternalRemoteDiffState / InternalDiffState in diff state model? Then we could pop and log the load time once we transition from loading -> loaded / error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - will update!

@MaggieShan MaggieShan force-pushed the maggs/remote-server-code-review-telem branch from 3a8f222 to d2120d8 Compare May 21, 2026 19:16
@MaggieShan MaggieShan enabled auto-merge (squash) May 21, 2026 19:24
@MaggieShan MaggieShan merged commit 1fb7381 into master May 21, 2026
25 checks passed
@MaggieShan MaggieShan deleted the maggs/remote-server-code-review-telem branch May 21, 2026 19:58
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