Skip to content

Add os.name, os.type, and os.version attributes to CLI telemetry#14922

Merged
JamesNK merged 1 commit intorelease/13.2from
cli/add-os-telemetry-attributes
Mar 4, 2026
Merged

Add os.name, os.type, and os.version attributes to CLI telemetry#14922
JamesNK merged 1 commit intorelease/13.2from
cli/add-os-telemetry-attributes

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Mar 4, 2026

Description

Add os.name, os.type, and os.version attributes to telemetry captured in the Aspire CLI. These follow the OpenTelemetry semantic conventions for OS and provide visibility into which operating systems CLI users are running on.

Changes:

  • Added os.name, os.type, and os.version tag constants to TelemetryConstants.Tags
  • Populated the tags in AspireCliTelemetry.InitializeAsync() using RuntimeInformation.OSDescription, a GetOsType() helper (returns windows/linux/darwin), and Environment.OSVersion.Version
  • Added a test verifying the OS tags are present after initialization

Background for this change: Telemetry from Azure Monitor Exporter wasn't correctly identifying macOS. The fix is to add our own attributes for identifing OS.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

Copilot AI review requested due to automatic review settings March 4, 2026 00:57
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14922

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14922"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds additional OS-related attributes to Aspire CLI telemetry to improve visibility into the operating systems that CLI users are running, aligning with OpenTelemetry-style OS resource attributes.

Changes:

  • Added os.name, os.type, and os.version tag constants to CLI telemetry constants.
  • Populated these OS tags during AspireCliTelemetry.InitializeAsync().
  • Added a unit test asserting the OS tags exist after initialization.

Reviewed changes

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

File Description
tests/Aspire.Cli.Tests/Telemetry/AspireCliTelemetryTests.cs Adds a test to verify OS tags are present after telemetry initialization.
src/Aspire.Cli/Telemetry/TelemetryConstants.cs Introduces new tag constants for OS name/type/version.
src/Aspire.Cli/Telemetry/AspireCliTelemetry.cs Populates new OS tags and adds a helper to map OS platform to os.type.

@JamesNK JamesNK requested a review from DamianEdwards March 4, 2026 00:59
@JamesNK JamesNK force-pushed the cli/add-os-telemetry-attributes branch from 1fa3922 to 8e6d8e0 Compare March 4, 2026 01:03
@JamesNK JamesNK enabled auto-merge (squash) March 4, 2026 01:07
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 8e6d8e0:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AgentInitCommand_WithMalformedMcpJson_ShowsErrorAndExitsNonZero ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ❌ Upload failed
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22650209756

@JamesNK JamesNK merged commit bf68f59 into release/13.2 Mar 4, 2026
758 of 761 checks passed
@JamesNK JamesNK deleted the cli/add-os-telemetry-attributes branch March 4, 2026 02:08
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants