Skip to content

fix: stop recording self completions in telemetry - #8

Merged
manuelmauro merged 1 commit into
mainfrom
fix/telemetry-skip-completions
Jul 9, 2026
Merged

fix: stop recording self completions in telemetry#8
manuelmauro merged 1 commit into
mainfrom
fix/telemetry-skip-completions

Conversation

@manuelmauro

@manuelmauro manuelmauro commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Problem

arkouda self completions zsh is meant to be wired into a shell startup file:

eval "$(arkouda self completions zsh)"

which means it fires once per shell opened, not once per deliberate use of the tool. It therefore floods the telemetry log with events that carry no information about how arkouda is actually used.

On a local log covering 2026-05-20 → 2026-07-09, this was 765 of 1056 events (72%). Filtering it out leaves 291 real invocations — and only then does the log answer the questions the telemetry ADR was written to answer. For instance, decision --section turns out to be used in 1 of 30 decision calls, despite the skill prompt recommending it.

Change

Skip telemetry for self completions.

The ADR already documented command as one of list, decision, check, or newself was never part of the recorded set, so this is implementation drift being corrected rather than a decision being reversed. The ADR's "What is not recorded" section is updated to state the exclusion explicitly.

Command::is_recorded() matches on the inner SelfCommand::Completions rather than on all of SelfCmd, so a future self subcommand (e.g. self update) is not silently dropped from the log.

Verification

  • make ci green: fmt, clippy, 30 tests, arkouda check clean on all 4 ADRs.
  • Two new unit tests drive the real clap parser rather than hand-built enum values.
  • Checked end-to-end against a scratch ARKOUDA_STATE_DIR: three self completions zsh runs create no log file at all, while check and list still record normally.

Note for reviewers

Existing logs still contain the historical self events. They can be dropped in place with:

jq -c 'select(.command != "self")' telemetry.jsonl | sponge telemetry.jsonl

Downstream consumers should tolerate their presence in older files either way.

Summary by CodeRabbit

  • Bug Fixes

    • Telemetry now skips shell-completion startup activity, reducing noisy records during terminal launch.
    • Telemetry is only sent for commands that should be tracked, avoiding unnecessary reporting for excluded invocations.
  • Documentation

    • Clarified which command invocations are not included in telemetry tracking.

`eval "$(arkouda self completions zsh)"` in a shell startup file fires one
telemetry event per shell opened rather than per deliberate use. On a
sample local log this accounted for 765 of 1056 events (72%), burying the
real invocations the log exists to surface.

The telemetry ADR already documented `command` as one of `list`,
`decision`, `check`, or `new`, so `self` was never part of the recorded
set; this brings the implementation back in line with it.

Match on `SelfCommand::Completions` rather than all of `SelfCmd` so a
future `self` subcommand is not silently dropped from the log.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dfab2dd0-c8a9-424f-962d-f1a03eb81a65

📥 Commits

Reviewing files that changed from the base of the PR and between 8fa79fd and 994842c.

📒 Files selected for processing (3)
  • docs/adr/telemetry-for-agent-command-invocations.md
  • src/main.rs
  • src/telemetry.rs

📝 Walkthrough

Walkthrough

Adds an is_recorded method to Command in src/telemetry.rs that excludes self completions invocations from telemetry, updates src/main.rs to gate telemetry recording on this check, extends tests, and documents the exclusion in the ADR.

Changes

Telemetry recording exclusion

Layer / File(s) Summary
is_recorded method and tests
src/telemetry.rs
Adds SelfCommand import and Command::is_recorded(&self) -> bool, returning false for SelfCmd(SelfCommand::Completions(_)) and true otherwise; extends tests with a command_of helper asserting completions are excluded and other commands are included.
Wiring and documentation
src/main.rs, docs/adr/telemetry-for-agent-command-invocations.md
Guards the telemetry recording call in main with cli.command.is_recorded(), and adds a bullet to the ADR's "not recorded" list excluding self completions due to shell-startup eval invocation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Main
  participant Cli
  participant Command
  participant Telemetry
  Main->>Cli: parse args
  Main->>Command: is_recorded()
  Command-->>Main: true/false
  alt is_recorded == true
    Main->>Telemetry: record event
  else is_recorded == false
    Main->>Main: skip recording
  end
Loading

Possibly related PRs

  • manuelmauro/arkouda#2: Introduces the baseline telemetry/event recording that this PR extends with Command::is_recorded() gating.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: excluding self completions from telemetry.
Description check ✅ Passed The PR description covers the problem, change, verification, and reviewer notes, so it is mostly complete despite using different headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/telemetry-skip-completions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@manuelmauro
manuelmauro merged commit 91c8702 into main Jul 9, 2026
2 checks passed
@manuelmauro
manuelmauro deleted the fix/telemetry-skip-completions branch July 9, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant