-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
C#: Extract dependency restore telemetry data #15518
Conversation
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) |
There was a problem hiding this comment.
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)
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs
Outdated
Show resolved
Hide resolved
csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs
Outdated
Show resolved
Hide resolved
csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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 thecompilation_info
table, and then returned incs/telemetry/extraction-information
.