feat(cli): tag atk telemetry with caller-source from ATK_CALLER#16295
Merged
tecton merged 3 commits intoJul 9, 2026
Conversation
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>
Contributor
There was a problem hiding this comment.
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_CALLER → caller-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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
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
previously approved these changes
Jul 8, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tecton
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an optional
caller-sourcetelemetry property, populated from theATK_CALLERenvironment variable, so runs driven by a wrapper tool (e.g. wiqd) are distinguishable from direct CLI usage in theteamsfx_all_clidata. Mirrors the existingATK_CLI_SKILL->skillpattern. 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.