Skip to content

feat(cli): tag atk telemetry with caller-source from ATK_CALLER#16295

Merged
tecton merged 3 commits into
OfficeDev:devfrom
JimmyCalhoun:feat/atk-telemetry-caller-source
Jul 9, 2026
Merged

feat(cli): tag atk telemetry with caller-source from ATK_CALLER#16295
tecton merged 3 commits into
OfficeDev:devfrom
JimmyCalhoun:feat/atk-telemetry-caller-source

Conversation

@JimmyCalhoun

Copy link
Copy Markdown
Contributor

Add an optional caller-source telemetry property, populated from the ATK_CALLER environment variable, so runs driven by a wrapper tool (e.g. wiqd) are distinguishable from direct CLI usage in the teamsfx_all_cli data. Mirrors the existing ATK_CLI_SKILL -> skill pattern. The value is sanitized to a bounded lowercase slug to keep it low-cardinality and free of PII, since it comes from free-form process input.

Add an optional `caller-source` telemetry property, populated from the
`ATK_CALLER` environment variable, so runs driven by a wrapper tool (e.g.
wiqd) are distinguishable from direct CLI usage in the `teamsfx_all_cli`
data. Mirrors the existing `ATK_CLI_SKILL` -> `skill` pattern. The value is
sanitized to a bounded lowercase slug to keep it low-cardinality and free
of PII, since it comes from free-form process input.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the CLI telemetry model to optionally tag events with a caller-source dimension derived from the ATK_CALLER environment variable, so wrapper-driven invocations can be distinguished from direct CLI usage.

Changes:

  • Added TelemetryProperty.CallerSource (caller-source) to the CLI telemetry property enum.
  • Updated CLI argument parsing to read ATK_CALLER, sanitize it, and attach it to both per-command telemetry properties and shared telemetry properties.
  • Added unit tests covering presence/absence and sanitization behavior of ATK_CALLER.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/cli/tests/unit/engine.tests.ts Adds unit tests validating ATK_CALLERcaller-source behavior and sanitization.
packages/cli/src/telemetry/cliTelemetryEvents.ts Introduces the new caller-source telemetry property key.
packages/cli/src/commands/engine.ts Implements reading/sanitizing ATK_CALLER and wiring it into telemetry properties.

Comment thread packages/cli/src/commands/engine.ts Outdated
Comment thread packages/cli/src/commands/engine.ts Outdated
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.27%. Comparing base (5a63f31) to head (5d0c2c1).
⚠️ Report is 71 commits behind head on dev.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #16295      +/-   ##
==========================================
- Coverage   88.73%   87.27%   -1.46%     
==========================================
  Files         216      633     +417     
  Lines        9867    33129   +23262     
  Branches     2069     7727    +5658     
==========================================
+ Hits         8755    28913   +20158     
- Misses        622     2402    +1780     
- Partials      490     1814    +1324     
Files with missing lines Coverage Δ
packages/cli/src/commands/engine.ts 88.92% <100.00%> (+0.36%) ⬆️
packages/cli/src/telemetry/cliTelemetryEvents.ts 100.00% <100.00%> (ø)

... and 433 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Address PR review feedback on the caller-source telemetry property:
make the helper private, and resolve ATK_CALLER against a known-caller
allowlist instead of emitting a sanitized free-form slug. Recognized
values map to themselves; any other declared value collapses to "other",
keeping the telemetry dimension low-cardinality and free of PII. Add a
near-miss test to lock in exact-match behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tecton
tecton previously approved these changes Jul 8, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tecton tecton merged commit daa9cbf into OfficeDev:dev Jul 9, 2026
21 of 24 checks passed
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.

3 participants