feat(extensions): classify source telemetry - #9452
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds privacy-safe extension-source categorization, persistence, and telemetry across install, upgrade, promotion, registration, and inventory flows.
Changes:
- Classifies and persists fixed source categories.
- Replaces raw source telemetry with category attributes.
- Updates telemetry documentation and tests.
Show a summary per file
| File | Description |
|---|---|
docs/specs/metrics-audit/telemetry-schema.md |
Documents category fields. |
docs/specs/metrics-audit/feature-telemetry-matrix.md |
Updates extension telemetry coverage. |
docs/reference/telemetry-data.md |
Documents public telemetry fields. |
cli/azd/pkg/extensions/upgrade_result.go |
Carries source categories through upgrades. |
cli/azd/pkg/extensions/source.go |
Propagates categories from sources. |
cli/azd/pkg/extensions/source_manager.go |
Categorizes created sources. |
cli/azd/pkg/extensions/source_category.go |
Implements source classification. |
cli/azd/pkg/extensions/source_category_test.go |
Tests classification and normalization. |
cli/azd/pkg/extensions/registry.go |
Adds category metadata. |
cli/azd/pkg/extensions/manager.go |
Persists and emits categories. |
cli/azd/pkg/extensions/manager_test.go |
Tests category persistence. |
cli/azd/pkg/extensions/extension.go |
Stores installed categories. |
cli/azd/internal/tracing/fields/fields.go |
Defines category attributes. |
cli/azd/docs/tracing-in-azd.md |
Updates tracing guidance. |
cli/azd/docs/extensions/extension-resolution-and-versioning.md |
Explains source categories. |
cli/azd/cmd/telemetry_test.go |
Validates telemetry keys and coverage. |
cli/azd/cmd/middleware/telemetry.go |
Emits installed-category inventory. |
cli/azd/cmd/middleware/telemetry_test.go |
Tests inventory telemetry privacy. |
cli/azd/cmd/extension.go |
Emits command and lifecycle categories. |
cli/azd/cmd/extension_upgrade_test.go |
Tests upgrade category selection. |
cli/azd/cmd/extension_test.go |
Tests source-registration telemetry. |
cli/azd/cmd/extension_bundle_test.go |
Tests bundle category persistence. |
Review details
- Files reviewed: 22/22 changed files
- Comments generated: 4
- Review effort level: Balanced
e8eac8c to
16cb24c
Compare
16cb24c to
00e651c
Compare
7d5dc8c to
713c9b5
Compare
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
Review details
Suppressed comments (1)
cli/azd/internal/tracing/fields/fields.go:1177
- [azd-code-reviewer] These new telemetry fields trigger the repository's mandatory telemetry process, but the PR description does not include the Telemetry Change Checklist or record the required privacy review. Please copy and complete the checklist and trigger privacy review as required by
docs/specs/metrics-audit/privacy-review-checklist.md:8-20,196-240before merging.
ExtensionsInstalledSourceCategories = AttributeKey{
- Files reviewed: 30/30 changed files
- Comments generated: 0 new
- Review effort level: Balanced
ec393c2 to
6961501
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (2)
cli/azd/internal/tracing/fields/fields.go:1180
- [azd-code-reviewer] These new attribute keys trigger the repository's mandatory privacy-review process, but the PR description does not include the required Telemetry Change Checklist or indicate that privacy review was triggered. Please add and complete that checklist before merging; see
docs/specs/metrics-audit/privacy-review-checklist.md:8-11,196-220.
// ExtensionsInstalledSourceCategories records installed extensions as "id@category".
ExtensionsInstalledSourceCategories = AttributeKey{
Key: attribute.Key("extension.installed.source.category"),
Classification: SystemMetadata,
Purpose: FeatureInsight,
cli/azd/docs/tracing-in-azd.md:85
- [azd-code-reviewer] The sample uses
updated, butUpgradeStatus.String()emitsupgraded, so this example does not match actual telemetry. Useupgraded, consistent with the attribute table below.
| `ext.update` | Updating one extension attempt. | `extension.id`, `extension.version.from`, `extension.version.to`, `extension.source.category`, `extension.update.duration_ms`, `extension.update.outcome`. | `name=ext.update`, `extension.id=microsoft.azd.ai`, `extension.version.from=1.1.0`, `extension.version.to=1.2.0`, `extension.source.category=azd`, `extension.update.outcome=updated` |
- Files reviewed: 23/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
6961501 to
2059a0f
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (3)
cli/azd/internal/tracing/fields/fields.go:1181
- [azd-code-reviewer] These new attribute keys trigger the repository's mandatory telemetry privacy review and PR checklist (
docs/specs/metrics-audit/privacy-review-checklist.md:8-28,196-240;cli/azd/AGENTS.md:300-305). The PR description does not include the completed Telemetry Change Checklist. Add it and ensure the required privacy review is recorded before merging.
// ExtensionsInstalledSourceCategories records installed extensions as "id@category".
ExtensionsInstalledSourceCategories = AttributeKey{
Key: attribute.Key("extension.installed.source.category"),
Classification: SystemMetadata,
Purpose: FeatureInsight,
}
cli/azd/cmd/extension.go:2617
- [azd-code-reviewer] This assignment occurs after compatibility and target-version resolution. Once
selectedExthas been chosen, either of those checks can fail, and the deferredext.updatespan then emits the installed category copied at line 2411 instead of the selected target category. SetToSourceCategoryimmediately after source selection so only genuinely unresolved updates retain the installed category.
baseResult.ToSourceCategory = selectedExt.SourceCategoryOrUnknown()
cli/azd/docs/tracing-in-azd.md:85
- [azd-code-reviewer] The emitted outcome is
upgraded, notupdated:upgradeOneExtensionwritesbaseResult.Status.String(), andUpgradeStatusUpgraded.String()returns"upgraded"(cli/azd/pkg/extensions/upgrade_result.go:27-30). Correct the sample so consumers do not query a value that is never emitted.
| `ext.update` | Updating one extension attempt. | `extension.id`, `extension.version.from`, `extension.version.to`, `extension.source.category`, `extension.update.duration_ms`, `extension.update.outcome`. | `name=ext.update`, `extension.id=microsoft.azd.ai`, `extension.version.from=1.1.0`, `extension.version.to=1.2.0`, `extension.source.category=azd`, `extension.update.outcome=updated` |
- Files reviewed: 23/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d743ee8d-6f2c-4244-9ca9-b64fb20643d1
There was a problem hiding this comment.
Review details
Suppressed comments (1)
cli/azd/internal/tracing/fields/fields.go:1181
- [azd-code-reviewer] This new telemetry field triggers the repository's mandatory privacy-review process, but the PR description has neither the required Telemetry Change Checklist nor confirmation that a privacy review was triggered. Please complete both before merging, as required by
docs/specs/metrics-audit/privacy-review-checklist.md:8-20,196-240.
// ExtensionsInstalledSourceCategories records installed extensions as "id@category".
ExtensionsInstalledSourceCategories = AttributeKey{
Key: attribute.Key("extension.installed.source.category"),
Classification: SystemMetadata,
Purpose: FeatureInsight,
}
- Files reviewed: 24/24 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
There was a problem hiding this comment.
Review details
Suppressed comments (3)
cli/azd/internal/tracing/fields/fields.go:1177
- [azd-code-reviewer] These new fields trigger the mandatory privacy-review process, and removing the old source fields also changes the raw telemetry shape. The provided PR description omits the required Telemetry Change Checklist and downstream-review confirmation from
docs/specs/metrics-audit/privacy-review-checklist.md:8-11,42-65,196-240; add the completed checklist and record the privacy/downstream review before merge.
ExtensionsInstalledSourceCategories = AttributeKey{
cli/azd/cmd/extension.go:2617
- [azd-code-reviewer] Set the target category as soon as
selectedExtis chosen.resolveCompatibleExtensionand the empty-version check can return before this assignment, so a failed update against a resolved target source emits the installed category instead of the target category and misclassifies the failure.
baseResult.ToSourceCategory = selectedExt.SourceCategoryOrUnknown()
cli/azd/docs/tracing-in-azd.md:85
- [azd-code-reviewer] The emitted update outcome is
upgraded, notupdated;UpgradeStatus.String()and the telemetry contract test both useupgraded. Correct this sample so queries copied from the tracing guide match actual telemetry.
| `ext.update` | Updating one extension attempt. | `extension.id`, `extension.version.from`, `extension.version.to`, `extension.source.category`, `extension.update.duration_ms`, `extension.update.outcome`. | `name=ext.update`, `extension.id=microsoft.azd.ai`, `extension.version.from=1.1.0`, `extension.version.to=1.2.0`, `extension.source.category=azd`, `extension.update.outcome=updated` |
- Files reviewed: 26/26 changed files
- Comments generated: 0 new
- Review effort level: Balanced
05d2a54 to
919463b
Compare
|
/check-enforcer override Will investigate the code coverage failure as a follow-up, seems to be a false positive. |
There was a problem hiding this comment.
Review details
Suppressed comments (3)
cli/azd/internal/tracing/fields/fields.go:1181
- [azd-code-reviewer] Adding this key and the other source-category keys triggers the mandatory privacy review and telemetry PR checklist in
docs/specs/metrics-audit/privacy-review-checklist.md:8-20,196-240. The PR description contains neither the checklist nor a privacy-review acknowledgement. Add and complete the checklist before merge, including the downstream review for the removed/renamed raw keys.
ExtensionsInstalledSourceCategories = AttributeKey{
Key: attribute.Key("extension.installed.source.category"),
Classification: SystemMetadata,
Purpose: FeatureInsight,
}
cli/azd/cmd/extension.go:2617
- [azd-code-reviewer] This assignment happens after compatibility and target-version resolution. If a different source is selected and
resolveCompatibleExtensionor the no-versions path fails, the deferredext.updatespan still emits the installed category set at line 2411 even though the target source was resolved. SetToSourceCategoryimmediately afterselectedExtis chosen so only genuinely unresolved lookups retain the installed category.
baseResult.ToSourceCategory = selectedExt.SourceCategoryOrUnknown()
cli/azd/docs/tracing-in-azd.md:85
- [azd-code-reviewer] The sample uses
updated, butUpgradeStatus.String()emitsupgraded, which is also the documented public status contract inpkg/extensions/upgrade_result.go:8-11. Keep the telemetry example aligned with the emitted enum value.
| `ext.update` | Updating one extension attempt. | `extension.id`, `extension.version.from`, `extension.version.to`, `extension.source.category`, `extension.update.duration_ms`, `extension.update.outcome`. | `name=ext.update`, `extension.id=microsoft.azd.ai`, `extension.version.from=1.1.0`, `extension.version.to=1.2.0`, `extension.source.category=azd`, `extension.update.outcome=updated` |
- Files reviewed: 24/24 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
/check-enforcer override |
Closes #9435
Summary
This PR adds privacy-safe extension source categories derived from source type and location, persists them with installed extensions, and emits those categories for install, update, promotion, source registration, and installed inventory telemetry. This is the upper layer of stack #9453 and depends on #9451.
Source categories
azd,dev,nightly,local,bundle,other, orunknown.team-registry).sourceCategorywith installed extensions so classification survives source removal or location changes.unknown.Telemetry
extension.source.category,extension.source.category.from,extension.source.category.to, andextension.installed.source.category.extension.source,extension.source.from, andextension.source.to.Behaviour at a glance
azddevornightlylocalbundleotherunknownTesting
Covered known and resolved registry URLs, custom URLs and providers, source names that differ from their location-derived category, local files, bundles, legacy records, install persistence, update and dependency categories, source registration, installed inventory, raw-value exclusion, telemetry field contracts, extension command suites, build, linting, and spelling checks.