Skip to content

C#: Extract dependency restore telemetry data #15518

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

Merged

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Feb 5, 2024

This is a somewhat hacky way of extracting dependency restoration related data into the database. When the dependency manager is executed, there are no trap files yet, so we store the extracted (key, value) pairs in memory, and write it into the compilation trap file when that's created. The data is written into the compilation_info table, and then returned in cs/telemetry/extraction-information.

@github-actions github-actions bot added the C# label Feb 5, 2024
Parallel.ForEach(projects, new ParallelOptions { MaxDegreeOfParallelism = options.Threads }, project =>
{
logger.LogInfo($"Restoring project {project}...");
var res = dotnet.Restore(new(project, packageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: true));
assetFiles.AddRange(res.AssetsFilePaths);
lock (sync)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a small bugfix. We were previously updating assetFiles in the Parallel.ForEach without locking. (It's also needed for the successCount increment)

@tamasvajk tamasvajk marked this pull request as ready for review February 6, 2024 10:38
@tamasvajk tamasvajk requested a review from a team as a code owner February 6, 2024 10:38
michaelnebel
michaelnebel previously approved these changes Feb 6, 2024
Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

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

Very nice!

Co-authored-by: Michael Nebel <michaelnebel@github.com>
Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

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

LGTM!

@tamasvajk tamasvajk merged commit 54c9135 into github:main Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants