Repository navigation
Improve telemetry device detection stability - #11071
Open
Victor Vazquez (vhvb1989) wants to merge 1 commit into
Open
Victor Vazquez (vhvb1989) wants to merge 1 commit into
Victor Vazquez (vhvb1989) wants to merge 1 commit into
Conversation
Reuse the cached pseudonymous machine identifier and return the same value that is persisted. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 26 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Cached machine IDs are reused without validation, potentially exposing raw MAC addresses and retaining truncated identifiers across runs.
2 open issues
What changed in this PR
Stabilizes azd device telemetry by reusing the persisted pseudonymous machine.id across invocations.
Changes:
- Reads cached IDs first and calculates once when needed.
- Tests cache reuse, initial writes, and empty-cache recovery.
- Documents cached hash and UUID identifiers.
| File | Description |
|---|---|
| docs/specs/metrics-audit/telemetry-schema.md | Clarifies cached identifier sources. |
| docs/reference/telemetry-data.md | Describes cached IDs and UUID fallback. |
| cli/azd/internal/tracing/resource/resource_test.go | Adds cache behavior tests. |
| cli/azd/internal/tracing/resource/machine_id.go | Corrects cache reads and avoids duplicate calculation. |
Review effort: Max
Comment on lines
+70
to
+71
| if cached := strings.TrimSpace(string(bytes)); cached != "" { | ||
| return cached |
Comment on lines
+286
to
+287
| require.Equal(t, tt.wantValue, loadOrCalculate(calc, cacheFileName)) | ||
| require.Equal(t, tt.wantValue, loadOrCalculate(calc, cacheFileName)) |
JeffreyCA
approved these changes
Dec 2, 2026
hemarina
approved these changes
Dec 3, 2026
hemarina
left a comment
Contributor
There was a problem hiding this comment.
Copilot's review comments are worth addressing. The machine.id field name and type remain unchanged, so no Kusto schema update should be needed. The value may change for some devices after upgrading. LGTM otherwise.
This branch has not been deployed
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.


Summary
Improves telemetry device detection by reusing the persisted pseudonymous
machine.idvalue across azd invocations.Telemetry change
What changed:
machine.idcontinues to be a pseudonymous MAC-address hash or UUID fallback, but azd now reuses its cached value instead of recalculating it on each invocation.Why it is needed: Improves the stability of device-level telemetry.
Approval coverage (maintainer): pending assessment
Open questions or follow-ups: Confirm downstream reporting rollout with telemetry owners.
Validation
go test ./internal/tracing/resource -count=1go vet ./internal/tracing/resourcego fix ./internal/tracing/resource