From f2d5d1364fe760dcdd68cefb8e2c02f53ac20402 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:24:23 +0000 Subject: [PATCH 1/3] Initial plan From a902e0ed904eaf6fede7913ea9a9ca6ab1df9756 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:39:40 +0000 Subject: [PATCH 2/3] Add System.Diagnostics.Activities for early data collection - Added System.Diagnostics.DiagnosticSource package reference - Created ActivitySource for Microsoft.Dotnet.Installer library - Added Activity for DotnetInstaller.Install with tags for install root, arch, component, and version - Added sub-activities for Prepare and Commit stages in ArchiveDotnetExtractor Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- .../DotnetInstallRoot.cs | 1 + .../Internal/ArchiveDotnetExtractor.cs | 5 +++++ .../Internal/DotnetInstaller.cs | 7 +++++++ .../Internal/InstallationActivitySource.cs | 13 +++++++++++++ .../Internal/ReleaseManifest.cs | 2 +- .../Microsoft.Dotnet.Installation.csproj | 1 + 6 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs diff --git a/src/Installer/Microsoft.Dotnet.Installation/DotnetInstallRoot.cs b/src/Installer/Microsoft.Dotnet.Installation/DotnetInstallRoot.cs index 0deeb807808d..c279f4a5d471 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/DotnetInstallRoot.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/DotnetInstallRoot.cs @@ -6,6 +6,7 @@ using System.Text; namespace Microsoft.Dotnet.Installation; + public record DotnetInstallRoot( string Path, InstallArchitecture Architecture); diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/ArchiveDotnetExtractor.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/ArchiveDotnetExtractor.cs index acd883107d69..d5fc21ab6ca4 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Internal/ArchiveDotnetExtractor.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/ArchiveDotnetExtractor.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Formats.Tar; using System.IO; using System.IO.Compression; @@ -30,6 +31,8 @@ public ArchiveDotnetExtractor(DotnetInstallRequest request, ReleaseVersion resol public void Prepare() { + using var activity = InstallationActivitySource.ActivitySource.StartActivity("DotnetInstaller.Prepare"); + using var releaseManifest = new ReleaseManifest(); var archiveName = $"dotnet-{Guid.NewGuid()}"; _archivePath = Path.Combine(scratchDownloadDirectory, archiveName + DnupUtilities.GetArchiveFileExtensionForPlatform()); @@ -90,6 +93,8 @@ public void Commit() public void Commit(IEnumerable existingSdkVersions) { + using var activity = InstallationActivitySource.ActivitySource.StartActivity("DotnetInstaller.Commit"); + if (_archivePath == null || !File.Exists(_archivePath)) { throw new InvalidOperationException("Archive not found. Make sure Prepare() was called successfully."); diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetInstaller.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetInstaller.cs index 40fd2a48025f..66955c78c10b 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetInstaller.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetInstaller.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Text; using Microsoft.Deployment.DotNet.Releases; @@ -19,6 +20,12 @@ public DotnetInstaller(IProgressTarget progressTarget) public void Install(DotnetInstallRoot dotnetRoot, InstallComponent component, ReleaseVersion version) { + using var activity = InstallationActivitySource.ActivitySource.StartActivity("DotnetInstaller.Install"); + activity?.SetTag("install.root", dotnetRoot.Path); + activity?.SetTag("install.arch", dotnetRoot.Architecture.ToString()); + activity?.SetTag("install.component", component.ToString()); + activity?.SetTag("install.version", version.ToString()); + var installRequest = new DotnetInstallRequest(dotnetRoot, new UpdateChannel(version.ToString()), component, new InstallRequestOptions()); using ArchiveDotnetExtractor installer = new(installRequest, version, _progressTarget); diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs new file mode 100644 index 000000000000..991a5369f9b9 --- /dev/null +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; + +namespace Microsoft.Dotnet.Installation.Internal; + +internal static class InstallationActivitySource +{ + private static readonly ActivitySource s_activitySource = new("Microsoft.Dotnet.Installer", "1.0.0"); + + public static ActivitySource ActivitySource => s_activitySource; +} diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/ReleaseManifest.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/ReleaseManifest.cs index 85de5895bc2e..41ba700fa0e6 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Internal/ReleaseManifest.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/ReleaseManifest.cs @@ -74,7 +74,7 @@ static IEnumerable GetChannelsForProduct(Product product) .Select(v => $"{v.Major}.{v.Minor}.{(v.Patch / 100)}xx") .Distinct() .ToList() - ]; + ]; } } diff --git a/src/Installer/Microsoft.Dotnet.Installation/Microsoft.Dotnet.Installation.csproj b/src/Installer/Microsoft.Dotnet.Installation/Microsoft.Dotnet.Installation.csproj index c9b2c6d4509f..0de054e6c753 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Microsoft.Dotnet.Installation.csproj +++ b/src/Installer/Microsoft.Dotnet.Installation/Microsoft.Dotnet.Installation.csproj @@ -19,6 +19,7 @@ + From f92fa73b6c6c2959d3b605722c00b5ce6a68620f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 22:07:52 +0000 Subject: [PATCH 3/3] Use assembly version for ActivitySource instead of hardcoded version Get version from AssemblyInformationalVersionAttribute with "1.0.0" as fallback Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- .../Internal/InstallationActivitySource.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs index 991a5369f9b9..d66ba0d51bc2 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs @@ -2,12 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; +using System.Reflection; namespace Microsoft.Dotnet.Installation.Internal; internal static class InstallationActivitySource { - private static readonly ActivitySource s_activitySource = new("Microsoft.Dotnet.Installer", "1.0.0"); + private static readonly ActivitySource s_activitySource = new("Microsoft.Dotnet.Installer", + typeof(InstallationActivitySource).Assembly.GetCustomAttribute()?.InformationalVersion ?? "1.0.0"); public static ActivitySource ActivitySource => s_activitySource; }