Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report whether audit is enabled during no-op restores #6150

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ public async Task<RestoreResult> ExecuteAsync(CancellationToken token)
telemetry.TelemetryEvent[IsCentralPackageTransitivePinningEnabled] = isCentralPackageTransitivePinningEnabled;
}

bool auditEnabled = AuditUtility.ParseEnableValue(
nkolev92 marked this conversation as resolved.
Show resolved Hide resolved
_request.Project.RestoreMetadata?.RestoreAuditProperties,
_request.Project.FilePath,
_logger);
telemetry.TelemetryEvent[AuditEnabled] = auditEnabled ? "enabled" : "disabled";

var restoreTime = Stopwatch.StartNew();

// Local package folders (non-sources)
Expand Down Expand Up @@ -340,11 +346,6 @@ await _logger.LogAsync(RestoreLogMessage.CreateWarning(NuGetLogCode.NU1803,
});
}

bool auditEnabled = AuditUtility.ParseEnableValue(
_request.Project.RestoreMetadata?.RestoreAuditProperties,
_request.Project.FilePath,
_logger);
telemetry.TelemetryEvent[AuditEnabled] = auditEnabled ? "enabled" : "disabled";
bool auditRan = false;
if (auditEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2966,7 +2966,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async(

var projectInformationEvent = telemetryEvents.Single(e => e.Name.Equals("ProjectRestoreInformation"));

projectInformationEvent.Count.Should().Be(24);
projectInformationEvent.Count.Should().Be(25);
projectInformationEvent["RestoreSuccess"].Should().Be(true);
projectInformationEvent["NoOpResult"].Should().Be(true);
projectInformationEvent["IsCentralVersionManagementEnabled"].Should().Be(false);
Expand All @@ -2991,6 +2991,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async(
projectInformationEvent["NoOpCacheFileAgeDays"].Should().NotBeNull();
projectInformationEvent["UseLegacyDependencyResolver"].Should().BeOfType<bool>();
projectInformationEvent["UsedLegacyDependencyResolver"].Should().BeOfType<bool>();
projectInformationEvent["Audit.Enabled"].Should().BeOfType<string>();
}

[Fact]
Expand Down
Loading