-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reversed diagnostics server, endpoints, and endpoint sources. (#1303
) Add reversed diagnostics server and endpoint information. Add diagnostics endpoint source for unifying server and client connections into same contract. Consume endpoint source in dotnet-monitor. Add unit tests for reversed server, endpoints, and endpoint source concepts.
- Loading branch information
1 parent
732a607
commit 455c891
Showing
42 changed files
with
2,620 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Microsoft.Diagnostics.Monitoring/ClientEndpointInfoSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Diagnostics.NETCore.Client; | ||
|
||
namespace Microsoft.Diagnostics.Monitoring | ||
{ | ||
internal sealed class ClientEndpointInfoSource : IEndpointInfoSourceInternal | ||
{ | ||
public Task<IEnumerable<IEndpointInfo>> GetEndpointInfoAsync(CancellationToken token) | ||
{ | ||
List<IEndpointInfo> endpointInfos = new List<IEndpointInfo>(); | ||
foreach (int pid in DiagnosticsClient.GetPublishedProcesses()) | ||
{ | ||
// CONSIDER: Generate a "runtime instance identifier" based on the pipe name | ||
// e.g. pid + disambiguator in GUID form. | ||
endpointInfos.Add(new EndpointInfo(pid)); | ||
} | ||
|
||
return Task.FromResult(endpointInfos.AsEnumerable()); | ||
} | ||
|
||
private class EndpointInfo : IEndpointInfo | ||
{ | ||
public EndpointInfo(int processId) | ||
{ | ||
Endpoint = new PidIpcEndpoint(processId); | ||
ProcessId = processId; | ||
} | ||
|
||
public IpcEndpoint Endpoint { get; } | ||
|
||
public int ProcessId { get; } | ||
|
||
public Guid RuntimeInstanceCookie => Guid.Empty; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/Microsoft.Diagnostics.Monitoring/Configuration/SampleProfilerConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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 Microsoft.Diagnostics.NETCore.Client; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.Tracing; | ||
|
||
namespace Microsoft.Diagnostics.Monitoring | ||
{ | ||
public sealed class SampleProfilerConfiguration : MonitoringSourceConfiguration | ||
{ | ||
public override IList<EventPipeProvider> GetProviders() => | ||
new EventPipeProvider[] | ||
{ | ||
new EventPipeProvider(SampleProfilerProviderName, EventLevel.Informational) | ||
}; | ||
|
||
public override int BufferSizeInMB => 1; | ||
|
||
public override bool RequestRundown => false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/Microsoft.Diagnostics.Monitoring/Contracts/IEndpointInfoSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Diagnostics.NETCore.Client; | ||
|
||
namespace Microsoft.Diagnostics.Monitoring | ||
{ | ||
internal interface IEndpointInfo | ||
{ | ||
IpcEndpoint Endpoint { get; } | ||
|
||
int ProcessId { get; } | ||
|
||
Guid RuntimeInstanceCookie { get; } | ||
} | ||
|
||
public interface IEndpointInfoSource | ||
{ | ||
} | ||
|
||
internal interface IEndpointInfoSourceInternal : IEndpointInfoSource | ||
{ | ||
Task<IEnumerable<IEndpointInfo>> GetEndpointInfoAsync(CancellationToken token); | ||
} | ||
} |
Oops, something went wrong.