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

Use distinct EventSource names for compiler and workspace layer events #75613

Merged
merged 1 commit into from
Oct 24, 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@

namespace Microsoft.CodeAnalysis
{
[EventSource(Name = "Microsoft-CodeAnalysis-General")]
internal sealed class CodeAnalysisEventSource : EventSource
internal sealed partial class CodeAnalysisEventSource : EventSource
{
public static readonly CodeAnalysisEventSource Log = new CodeAnalysisEventSource();

public static class Keywords
{
public const EventKeywords Performance = (EventKeywords)1;
Expand Down
15 changes: 15 additions & 0 deletions src/Compilers/Core/Portable/CodeAnalysisEventSource.Compiler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Diagnostics.Tracing;

namespace Microsoft.CodeAnalysis
{
[EventSource(Name = "Microsoft-CodeAnalysis-General")]
internal sealed partial class CodeAnalysisEventSource
{
public static readonly CodeAnalysisEventSource Log = new CodeAnalysisEventSource();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal of putting this member here is to make it so you can't log events at all if you forget to declare a partial which specifies the event source name.

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Diagnostics.Tracing;

namespace Microsoft.CodeAnalysis
{
[EventSource(Name = "Microsoft-CodeAnalysis-Workspaces")]
Copy link
Member

Choose a reason for hiding this comment

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

Are we going to need to ask the RPS folks to turn this collector on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am expecting the following PR to enable this collector: https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/587560

internal sealed partial class CodeAnalysisEventSource
{
public static readonly CodeAnalysisEventSource Log = new CodeAnalysisEventSource();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Compile Include="..\..\..\Compilers\Core\Portable\DiagnosticAnalyzer\DefaultAnalyzerAssemblyLoader.cs" Link="Diagnostics\CompilerShared\DefaultAnalyzerAssemblyLoader.cs" />
<Compile Include="..\..\..\Compilers\Core\Portable\DiagnosticAnalyzer\ShadowCopyAnalyzerAssemblyLoader.cs" Link="Diagnostics\CompilerShared\ShadowCopyAnalyzerAssemblyLoader.cs" />
<Compile Include="..\..\..\Compilers\Core\Portable\DiagnosticAnalyzer\IAnalyzerAssemblyResolver.cs" Link="Diagnostics\CompilerShared\IAnalyzerAssemblyResolver.cs" />
<Compile Include="..\..\..\Compilers\Core\Portable\CodeAnalysisEventSource.cs" Link="Diagnostics\CompilerShared\CodeAnalysisEventSource.cs" />
<Compile Include="..\..\..\Compilers\Core\Portable\CodeAnalysisEventSource.Common.cs" Link="Diagnostics\CompilerShared\CodeAnalysisEventSource.Common.cs" />
<Compile Include="..\..\..\Compilers\Core\Portable\Text\SourceHashAlgorithms.cs" Link="Text\SourceHashAlgorithms.cs" />
<Compile Include="..\..\..\Compilers\Core\Portable\AssemblyUtilitiesCore.cs" Link="AssemblyUtilitiesCore.cs" />
</ItemGroup>
Expand Down