Skip to content

Commit

Permalink
Renamed EventSources "Microsoft-"->"Private.InternalDiagnostics.".
Browse files Browse the repository at this point in the history
  • Loading branch information
ManickaP authored Aug 17, 2020
1 parent b41f1c5 commit ba7c518
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace System.Net.Test.Common
{
[EventSource(Name = "Microsoft-System-Net-TestLogging")]
[EventSource(Name = "System.Net.TestLogging")]
internal class EventSourceTestLogging : EventSource
{
private static EventSourceTestLogging s_log = new EventSourceTestLogging();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Without further ado, here is an example on how to use the `EventCounter`

```c#
// Give your event sources a descriptive name using the EventSourceAttribute, otherwise the name of the class is used.
[EventSource(Name = "Samples-EventCounterDemos-Minimal")]
[EventSource(Name = "Samples.EventCounterDemos.Minimal")]
public sealed class MinimalEventCounterSource : EventSource
{
// define the singleton instance of the event source
Expand Down Expand Up @@ -49,7 +49,7 @@ So, with that, we logged the metric to the `EventCounter`, but unless we can act
There is an extra keyword that you will need to specify the turn on the EventCounters.

```
PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:EventCounterIntervalSec=1 collect
PerfView /onlyProviders=*Samples.EventCounterDemos.Minimal:EventCounterIntervalSec=1 collect
```

Note the part about `EventCounterIntervalSec`, that indicate the frequency of the sampling.
Expand All @@ -73,7 +73,7 @@ Notice that this command also logs the events, so we will get both the events an
As we mentioned, to avoid overhead, sometimes we will want just the counters. This command can be used to log *only* the counters:

```
PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:*:Critical:EventCounterIntervalSec=1 collect
PerfView /onlyProviders=*Samples.EventCounterDemos.Minimal:*:Critical:EventCounterIntervalSec=1 collect
```

Notice the `Critical` keyword in the command line, that is used to filter out the other events with lower priorities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Http-WinHttpHandler", LocalizationResources = "FxResources.System.Net.Http.WinHttpHandler.SR")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Http.WinHttpHandler", LocalizationResources = "FxResources.System.Net.Http.WinHttpHandler.SR")]
internal sealed partial class NetEventSource : EventSource
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Http", LocalizationResources = "FxResources.System.Net.Http.SR")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Http", LocalizationResources = "FxResources.System.Net.Http.SR")]
internal sealed partial class NetEventSource : EventSource
{
private const int UriBaseAddressId = NextAvailableEventId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ public abstract class DiagnosticsTest : HttpClientHandlerTestBase
public DiagnosticsTest(ITestOutputHelper output) : base(output) { }

[Fact]
public static void EventSource_ExistsWithCorrectId()
public void EventSource_ExistsWithCorrectId()
{
Type esType = typeof(HttpClient).GetTypeInfo().Assembly
.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Type esType = typeof(HttpClient).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-Http", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("bdd9a83e-1929-5482-0d73-2fe5e1c0e16d"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Http", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("a60cec70-947b-5b80-efe2-7c5547b99b3d"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, "assemblyPathToIncludeInManifest"));
}
Expand Down Expand Up @@ -183,7 +182,7 @@ public void SendAsync_HttpTracingEnabled_Succeeds(bool useSsl)
{
RemoteExecutor.Invoke(async (useVersionString, useSslString) =>
{
using (var listener = new TestEventListener("Microsoft-System-Net-Http", EventLevel.Verbose))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Http", EventLevel.Verbose))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();
await listener.RunWithCallbackAsync(events.Enqueue, async () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static bool TryParseCli(string[] args, [NotNullWhen(true)] out Configura
cmd.AddOption(new Option("-connectionLifetime", "Max connection lifetime length (milliseconds).") { Argument = new Argument<int?>("connectionLifetime", null) });
cmd.AddOption(new Option("-ops", "Indices of the operations to use") { Argument = new Argument<int[]?>("space-delimited indices", null) });
cmd.AddOption(new Option("-xops", "Indices of the operations to exclude") { Argument = new Argument<int[]?>("space-delimited indices", null) });
cmd.AddOption(new Option("-trace", "Enable Microsoft-System-Net-Http tracing.") { Argument = new Argument<string>("\"console\" or path") });
cmd.AddOption(new Option("-trace", "Enable System.Net.Http.InternalDiagnostics tracing.") { Argument = new Argument<string>("\"console\" or path") });
cmd.AddOption(new Option("-aspnetlog", "Enable ASP.NET warning and error logging.") { Argument = new Argument<bool>("enable", false) });
cmd.AddOption(new Option("-listOps", "List available options.") { Argument = new Argument<bool>("enable", false) });
cmd.AddOption(new Option("-seed", "Seed for generating pseudo-random parameters for a given -n argument.") { Argument = new Argument<int?>("seed", null) });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ private sealed class HttpEventListener : EventListener

protected override void OnEventSourceCreated(EventSource eventSource)
{
if (eventSource.Name == "Microsoft-System-Net-Http")
if (eventSource.Name == "Private.InternalDiagnostics.System.Net.Http")
EnableEvents(eventSource, EventLevel.LogAlways);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-HttpListener", LocalizationResources = "FxResources.System.Net.HttpListener.SR")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.HttpListener", LocalizationResources = "FxResources.System.Net.HttpListener.SR")]
internal sealed partial class NetEventSource
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Mail", LocalizationResources = "FxResources.System.Net.Mail.SR")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Mail", LocalizationResources = "FxResources.System.Net.Mail.SR")]
internal sealed partial class NetEventSource { }
}
6 changes: 3 additions & 3 deletions src/libraries/System.Net.Mail/tests/Functional/LoggingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public void EventSource_ExistsWithCorrectId()
Type esType = typeof(SmtpClient).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-Mail", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("42c8027b-f048-58d2-537d-a4a9d5ee7038"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Mail", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("6fff04ac-5aab-530c-03b3-b1b32d2538e9"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
Expand All @@ -28,7 +28,7 @@ public void EventSource_EventsRaisedAsExpected()
{
RemoteExecutor.Invoke(() =>
{
using (var listener = new TestEventListener("Microsoft-System-Net-Mail", EventLevel.Verbose))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Mail", EventLevel.Verbose))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();
listener.RunWithCallback(events.Enqueue, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-NameResolution")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.NameResolution")]
internal sealed partial class NetEventSource { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ public class LoggingTest
[Fact]
public static void EventSource_ExistsWithCorrectId()
{
Type esType = typeof(Dns).GetTypeInfo().Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Type esType = typeof(Dns).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-NameResolution", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("5f302add-3825-520e-8fa0-627b206e2e7e"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.NameResolution", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("460a591a-715b-5647-5264-944bef811147"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, "assemblyPathToIncludeInManifest"));
}

[ConditionalFact]
public void GetHostEntry_InvalidHost_LogsError()
{
using (var listener = new TestEventListener("Microsoft-System-Net-NameResolution", EventLevel.Error))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.NameResolution", EventLevel.Error))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();

Expand Down Expand Up @@ -68,7 +68,7 @@ public void GetHostEntry_InvalidHost_LogsError()
[PlatformSpecific(~TestPlatforms.Windows)] // Unreliable on Windows.
public void GetHostEntryAsync_InvalidHost_LogsError()
{
using (var listener = new TestEventListener("Microsoft-System-Net-NameResolution", EventLevel.Error))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.NameResolution", EventLevel.Error))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();

Expand Down Expand Up @@ -102,7 +102,7 @@ public void GetHostEntryAsync_InvalidHost_LogsError()
[ConditionalFact]
public void GetHostEntry_ValidName_NoErrors()
{
using (var listener = new TestEventListener("Microsoft-System-Net-NameResolution", EventLevel.Verbose))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.NameResolution", EventLevel.Verbose))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-NetworkInformation")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.NetworkInformation")]
internal sealed partial class NetEventSource { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public void EventSource_ExistsWithCorrectId()
Type esType = typeof(NetworkChange).Assembly.GetType("System.Net.NetEventSource", throwOnError: false, ignoreCase: false);
if (esType != null)
{
Assert.Equal("Microsoft-System-Net-NetworkInformation", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("b8e42167-0eb2-5e39-97b5-acaca593d3a2"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.NetworkInformation", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("e090a35b-1033-5de3-89e3-01cde7c158ce"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Ping")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Ping")]
internal sealed partial class NetEventSource { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public void EventSource_ExistsWithCorrectId()
Type esType = typeof(Ping).Assembly.GetType("System.Net.NetEventSource", throwOnError: false, ignoreCase: false);
if (esType != null)
{
Assert.Equal("Microsoft-System-Net-Ping", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("a771ec4a-7260-59ce-0475-db257437ed8c"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Ping", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("37627c1f-34a9-539e-ab8c-84303b966b74"), EventSource.GetGuid(esType));
Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Primitives")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Primitives")]
internal sealed partial class NetEventSource { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public void EventSource_ExistsWithCorrectId()
Type esType = typeof(IPAddress).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-Primitives", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("a9f9e4e1-0cf5-5005-b530-3d37959d5e84"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Primitives", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("534f3517-0a04-520f-9d69-4778dd119fe1"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
Expand All @@ -28,7 +28,7 @@ public void EventSource_EventsRaisedAsExpected()
{
RemoteExecutor.Invoke(() =>
{
using (var listener = new TestEventListener("Microsoft-System-Net-Primitives", EventLevel.Verbose))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Primitives", EventLevel.Verbose))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();
listener.RunWithCallback(events.Enqueue, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Requests")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Requests")]
internal sealed partial class NetEventSource { }
}
4 changes: 2 additions & 2 deletions src/libraries/System.Net.Requests/tests/LoggingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public void EventSource_ExistsWithCorrectId()
Type esType = typeof(WebRequest).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-Requests", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("3763dc7e-7046-5576-9041-5616e21cc2cf"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Requests", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("de972c9f-4457-5dc5-e37b-aaf8033eb3a9"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Security", LocalizationResources = "FxResources.System.Net.Security.SR")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Security", LocalizationResources = "FxResources.System.Net.Security.SR")]
internal sealed partial class NetEventSource
{
private const int SecureChannelCtorId = NextAvailableEventId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public void EventSource_ExistsWithCorrectId()
Type esType = typeof(SslStream).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-Security", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("066c0e27-a02d-5a98-9a4d-078cc3b1a896"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Security", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("a0d627f0-c0f5-5a45-558a-6634a894c155"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
Expand All @@ -28,7 +28,7 @@ public void EventSource_EventsRaisedAsExpected()
{
RemoteExecutor.Invoke(() =>
{
using (var listener = new TestEventListener("Microsoft-System-Net-Security", EventLevel.Verbose))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Security", EventLevel.Verbose))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();
listener.RunWithCallback(events.Enqueue, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Sockets", Guid = "e03c0352-f9c9-56ff-0ea7-b94ba8cabc6b", LocalizationResources = "FxResources.System.Net.Sockets.SR")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Sockets", LocalizationResources = "FxResources.System.Net.Sockets.SR")]
internal sealed partial class NetEventSource
{
private const int AcceptedId = NextAvailableEventId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static void EventSource_ExistsWithCorrectId()
Type esType = typeof(Socket).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
Assert.NotNull(esType);

Assert.Equal("Microsoft-System-Net-Sockets", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("e03c0352-f9c9-56ff-0ea7-b94ba8cabc6b"), EventSource.GetGuid(esType));
Assert.Equal("Private.InternalDiagnostics.System.Net.Sockets", EventSource.GetName(esType));
Assert.Equal(Guid.Parse("ae391de7-a2cb-557c-dd34-fe00d0b98c7f"), EventSource.GetGuid(esType));

Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
}
Expand All @@ -37,7 +37,7 @@ public void EventSource_EventsRaisedAsExpected()
{
RemoteExecutor.Invoke(() =>
{
using (var listener = new TestEventListener("Microsoft-System-Net-Sockets", EventLevel.Verbose))
using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Sockets", EventLevel.Verbose))
{
var events = new ConcurrentQueue<EventWrittenEventArgs>();
listener.RunWithCallback(events.Enqueue, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace System.Diagnostics.Tracing
/// <remarks>
/// This is a minimal definition for a custom event source:
/// <code>
/// [EventSource(Name="Samples-Demos-Minimal")]
/// [EventSource(Name="Samples.Demos.Minimal")]
/// sealed class MinimalEventSource : EventSource
/// {
/// public static MinimalEventSource Log = new MinimalEventSource();
Expand Down

0 comments on commit ba7c518

Please sign in to comment.