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

Process Explorer -- Added Grpc Server #182

Merged
merged 14 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-prototypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet build $_ --configuration Release --no-restore; if ($LASTEXITCODE -ne 0 ) {throw "Build for $_ FAILED"; }}

- name: Test .Net
run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet test $_ --no-restore --verbosity normal --collect:"XPlat Code Coverage"}
run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet test $_ --configuration Release --no-restore --verbosity normal --collect:"XPlat Code Coverage"}
kruplm marked this conversation as resolved.
Show resolved Hide resolved


- name: Setup Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet build $_ --configuration Release --no-restore; if ($LASTEXITCODE -ne 0 ) {throw "Build for $_ FAILED"; }}
working-directory: src
- name: Test
run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet test $_ --no-restore --verbosity normal}
run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet test $_ --configuration Release --no-restore --verbosity normal}
working-directory: src
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{D12A440D-CF68-4A10-B673-4FCB41B4B0BC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3413C687-1DD1-4751-8C4F-0CD308248CB2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{55657FBD-CD23-40A2-B8E9-2BBE734924CC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalCollector", "src\LocalCollector\LocalCollector.csproj", "{FA0A0669-6699-4059-BDEF-4E5BFA73E50B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessExplorer.Core", "src\ProcessExplorer.Core\ProcessExplorer.Core.csproj", "{5B1C8C4A-6179-488F-B5DB-25A3C313286C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessExplorer.Server", "src\ProcessExplorer.Server\ProcessExplorer.Server.csproj", "{AF40EAD5-8A98-465E-BF26-2EB06274A384}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessExplorer.Abstractions", "src\ProcessExplorer.Abstractions\ProcessExplorer.Abstractions.csproj", "{51110571-1082-4790-AA00-3DDDEE80641A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessExplorer.Core.Tests", "test\ProcessExplorer.Core.Tests\ProcessExplorer.Core.Tests.csproj", "{3C2B4F9E-CA84-4FB1-AE2B-CC61886A3CE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessExplorer.Server.IntegrationTests", "test\ProcessExplorer.Server.EndToEndTests\ProcessExplorer.Server.IntegrationTests.csproj", "{18B9042E-0D77-4917-97FF-14BC34085385}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsoleApp", "test\TestConsoleApp\TestConsoleApp.csproj", "{B9A770BB-7FBE-46A9-A62E-5E7FDAD8EAA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsoleApp2", "test\TestConsoleApp2\TestConsoleApp2.csproj", "{F9BCB268-66F2-4551-ABB6-58E1843B5A64}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestApplications", "TestApplications", "{23E408F5-CA2E-4CBD-BAB1-48FFAC9F5357}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA0A0669-6699-4059-BDEF-4E5BFA73E50B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA0A0669-6699-4059-BDEF-4E5BFA73E50B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA0A0669-6699-4059-BDEF-4E5BFA73E50B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA0A0669-6699-4059-BDEF-4E5BFA73E50B}.Release|Any CPU.Build.0 = Release|Any CPU
{5B1C8C4A-6179-488F-B5DB-25A3C313286C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B1C8C4A-6179-488F-B5DB-25A3C313286C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B1C8C4A-6179-488F-B5DB-25A3C313286C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B1C8C4A-6179-488F-B5DB-25A3C313286C}.Release|Any CPU.Build.0 = Release|Any CPU
{AF40EAD5-8A98-465E-BF26-2EB06274A384}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF40EAD5-8A98-465E-BF26-2EB06274A384}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF40EAD5-8A98-465E-BF26-2EB06274A384}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF40EAD5-8A98-465E-BF26-2EB06274A384}.Release|Any CPU.Build.0 = Release|Any CPU
{51110571-1082-4790-AA00-3DDDEE80641A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51110571-1082-4790-AA00-3DDDEE80641A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51110571-1082-4790-AA00-3DDDEE80641A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51110571-1082-4790-AA00-3DDDEE80641A}.Release|Any CPU.Build.0 = Release|Any CPU
{3C2B4F9E-CA84-4FB1-AE2B-CC61886A3CE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C2B4F9E-CA84-4FB1-AE2B-CC61886A3CE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C2B4F9E-CA84-4FB1-AE2B-CC61886A3CE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C2B4F9E-CA84-4FB1-AE2B-CC61886A3CE7}.Release|Any CPU.Build.0 = Release|Any CPU
{18B9042E-0D77-4917-97FF-14BC34085385}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18B9042E-0D77-4917-97FF-14BC34085385}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18B9042E-0D77-4917-97FF-14BC34085385}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18B9042E-0D77-4917-97FF-14BC34085385}.Release|Any CPU.Build.0 = Release|Any CPU
{B9A770BB-7FBE-46A9-A62E-5E7FDAD8EAA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9A770BB-7FBE-46A9-A62E-5E7FDAD8EAA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9A770BB-7FBE-46A9-A62E-5E7FDAD8EAA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9A770BB-7FBE-46A9-A62E-5E7FDAD8EAA3}.Release|Any CPU.Build.0 = Release|Any CPU
{F9BCB268-66F2-4551-ABB6-58E1843B5A64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9BCB268-66F2-4551-ABB6-58E1843B5A64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9BCB268-66F2-4551-ABB6-58E1843B5A64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9BCB268-66F2-4551-ABB6-58E1843B5A64}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FA0A0669-6699-4059-BDEF-4E5BFA73E50B} = {3413C687-1DD1-4751-8C4F-0CD308248CB2}
{5B1C8C4A-6179-488F-B5DB-25A3C313286C} = {3413C687-1DD1-4751-8C4F-0CD308248CB2}
{AF40EAD5-8A98-465E-BF26-2EB06274A384} = {3413C687-1DD1-4751-8C4F-0CD308248CB2}
{51110571-1082-4790-AA00-3DDDEE80641A} = {3413C687-1DD1-4751-8C4F-0CD308248CB2}
{3C2B4F9E-CA84-4FB1-AE2B-CC61886A3CE7} = {55657FBD-CD23-40A2-B8E9-2BBE734924CC}
{18B9042E-0D77-4917-97FF-14BC34085385} = {55657FBD-CD23-40A2-B8E9-2BBE734924CC}
{B9A770BB-7FBE-46A9-A62E-5E7FDAD8EAA3} = {23E408F5-CA2E-4CBD-BAB1-48FFAC9F5357}
{F9BCB268-66F2-4551-ABB6-58E1843B5A64} = {23E408F5-CA2E-4CBD-BAB1-48FFAC9F5357}
{23E408F5-CA2E-4CBD-BAB1-48FFAC9F5357} = {55657FBD-CD23-40A2-B8E9-2BBE734924CC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {819F883C-DDD0-4F2B-82C5-820D4D6AB446}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

using ProcessExplorer.Abstractions.Entities.Connections;

namespace LocalCollector.Connections;

public class ConnectionMonitor : IConnectionMonitor
{
private ConnectionMonitorInfo Data { get; } = new();
ConnectionMonitorInfo IConnectionMonitor.Data
private readonly ConnectionMonitorInfo _connections = new();
ConnectionMonitorInfo IConnectionMonitor.Connections
{
get => Data;
get
{
lock (_locker)
{
return _connections;
}
}
}

private readonly object _locker = new();
Expand All @@ -26,31 +34,31 @@ ConnectionMonitorInfo IConnectionMonitor.Data

public ConnectionMonitor(SynchronizedCollection<ConnectionInfo> connections)
{
Data.Connections = connections;
_connections.Connections = connections;
}

public void AddConnection(ConnectionInfo connectionInfo)
{
lock (_locker)
{
Data.Connections.Add(connectionInfo);
_connections.Connections.Add(connectionInfo);
}
}

public void RemoveConnection(ConnectionInfo connectionInfo)
{
lock (_locker)
{
var element = Data.Connections
var element = _connections.Connections
.FirstOrDefault(x => x.Id == connectionInfo.Id);

if (element == null)
{
return;
}

var index = Data.Connections.IndexOf(element);
Data.Connections.RemoveAt(index);
var index = _connections.Connections.IndexOf(element);
_connections.Connections.RemoveAt(index);
}
}

Expand All @@ -60,37 +68,37 @@ public void AddConnections(SynchronizedCollection<ConnectionInfo> connections)
{
foreach (var conn in connections)
{
var element = Data.Connections
var element = _connections.Connections
.FirstOrDefault(item => item.Id == conn.Id);

if (element == null)
{
continue;
}

var index = Data.Connections.IndexOf(element);
var index = _connections.Connections.IndexOf(element);
if (index != -1)
{
Data.Connections[index] = conn;
_connections.Connections[index] = conn;
}
else
{
Data.Connections.Add(conn);
_connections.Connections.Add(conn);
}
}
}
}

public void UpdateConnection(Guid connId, ConnectionStatus status)
{
if (Data.Connections.Count <= 0)
{
return;
}

lock (_locker)
{
var conn = Data.Connections
if (_connections.Connections.Count <= 0)
{
return;
}

var conn = _connections.Connections
.FirstOrDefault(c => c.Id == connId);

if (conn == null || conn.Status == status.ToStringCached())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

using LocalCollector.Communicator;
using LocalCollector.Connections;
using LocalCollector.EnvironmentVariables;
using LocalCollector.Modules;
using LocalCollector.Registrations;
using ProcessExplorer.Abstractions.Entities;
using ProcessExplorer.Abstractions.Entities.Connections;
using ProcessExplorer.Abstractions.Infrastructure;

namespace LocalCollector;

Expand All @@ -23,7 +25,7 @@ public interface IProcessInfoCollector
/// <summary>
/// Contains information of the environment variables, connections, registrations, modules
/// </summary>
ProcessInfoCollectorData Data { get; }
ProcessInfoCollectorData ProcessInformation { get; }

/// <summary>
/// Adds a list of connections to the existing one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>true</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.10.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ProcessExplorer.Abstractions\ProcessExplorer.Abstractions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

using ProcessExplorer.Abstractions.Entities.Modules;

namespace LocalCollector.Modules;

public class ModuleMonitorInfo
Expand Down
Loading