-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add ETW event for project creation in ProjectSystemProjectFactory #80967
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
Add ETW event for project creation in ProjectSystemProjectFactory #80967
Conversation
- Added ProjectCreated event (ID 20) to CodeAnalysisEventSource.Workspaces.cs - Event logs projectSystemName and filePath parameters - Added event call in ProjectSystemProjectFactory.CreateAndAddToWorkspaceAsync after project is added to workspace - Built and verified changes compile successfully Co-authored-by: jasonmalinowski <[email protected]>
| public static readonly CodeAnalysisEventSource Log = new(); | ||
|
|
||
| [Event(20, Message = "Project '{0}' created with file path '{1}'", Level = EventLevel.Informational)] | ||
| internal void ProjectCreated(string projectSystemName, string? filePath) => WriteEvent(20, projectSystemName, filePath ?? string.Empty); |
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.
@chsienki Should this be defined in this file or in the other Common file? It looks like other workspace events are being defined there, but then I'm not entirely sure what this file is doing specifically or what the intent is for the different provider names.
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.
IIRC these got shared because the ALC events are shared across the compiler and workspaces code. @RikkiGibson would probably remember better.
There's nothing inherently wrong with having the events be declared only in the workspaces layer but means we have to not re-use the ID for something else in the shared layer.
We should probably refactor this to have a shared ALC event source and then separate ones for compiler and workspaces. For now I would suggest just putting it in the shared layer for simplicity though.
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.
See #75613 for context
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.
@copilot Can you move this addition to CodeAnalysisEventSource.Common.cs then?
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.
Done. Moved the ProjectCreated event to CodeAnalysisEventSource.Common.cs in commit 3a013db.
Per feedback from @jasonmalinowski and @chsienki, moved the ProjectCreated event definition from CodeAnalysisEventSource.Workspaces.cs to CodeAnalysisEventSource.Common.cs to keep event definitions in the shared layer for simplicity and avoid ID conflicts. Co-authored-by: jasonmalinowski <[email protected]>
Adds ETW instrumentation to log when projects are created and added to the workspace in
ProjectSystemProjectFactory.Changes
ProjectCreatedevent (ID 20) that logsprojectSystemNameandfilePathCreateAndAddToWorkspaceAsyncThe event follows the existing pattern used for analyzer reference logging and uses the next available event ID in the sequence. The event is defined in the shared
CodeAnalysisEventSource.Common.cslayer to avoid ID conflicts and maintain consistency with the architecture.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.