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

Conversation

lilla28
Copy link
Contributor

@lilla28 lilla28 commented Mar 30, 2023

There are lot of changes -> lot of them are : moving components to other folder, adjust/changing namespaces (as I renamed the projects too).

Main changes:

  • Removed one layer from the ProcessExplorer.Core: Now there is no ProcessMonitor, just ProcessInfoManager(abstract class: should implement for Linux and MAC(there is no option except using C++ libraries yet as I found from resources so far) still).
  • Collecting just PIDs instead of storing and changing all the time the items in it. So if there is an update for a PID, then before the sending through the server (UIHandler), we are collecting the OS specific data and then we without storing them we are sending to the UI's.
  • Added SubsystemLauncher without depending on the ModuleLoader (user should set the behavior for starting, restarting or stopping a process).
  • Added DI configuration possibility with tha ability to create the own server implementation.
  • Handled ObservabilityCollection.Subscribe to put the subsystem state changes into a queue (FIFO), and when a UI is connected (we are running a background task to watch the queue and the handlers), then we are taking the items out of it and updating the subsystems appropriately.

Added EndToEndTests, some Unit tests.

Changes per commits:

  1. ModulesPrototype example program fix, organization of logging, added GRpcProcessExplorer server, renamed variables, implemented IDisposable for IProcessInfoAggregator and IProcessMonitor instances:
  • Added the ProcessExplorer setup DI extensions to the Program.cs file,
  • Added method to the IProcessMontior to set the handlers, which will handle the events from the ProcessMonitor if a process created/terminated/modified
  • Implemented IDisposable for ProcessInfoManager, modified collection to ObservableCollection which will store just the processIds, and sets the action which should be taken when the relevant processes are created/terminated/modified. Removed some unnecessary methods, added some null checks inside the implementation
  • Adjust namespaces for multiple files
  • ISubsystemLauncher API changes: Task instead of ValueTask
  • SubsystemInfo: added helper static method to convert Module object to SubsystemInfo instance.
  • ProcessInfoAggregator: renamed some variables, null checks
  • Some whitespace changes through the files
  • Added gRPC and WebSocket Process Explorer Server implementation: initial
  1. Initial commit of tests, adjust namespaces, handle subsystem's status change, null checks for server implementation, delegating launch/stop/restart request:
  • ModulesPrototype: handling subsystem's status change: putting into a queue then after everything setup we handle it, by running a background task to watch the queue and push the messages if available.
  • ProtoConvertHelper: this class is helper class, which converts the objects, which should be sent to the UI to the applicable object type (Message), when using gRPC. If we won't want to extend the server implemntations by adding for example WebSocket, etc. then this could be leaved behind, and also just using the classes declared in the .proto file.
  • Added ConfigureSubsystemLAuncher, which takes 2 actions and 2 functions, which creates the relevant types to start and launch subsystems, also the exact methods which would start and stop subsystems.
  • Added SubsystemLAuncher implementation to the Core package, as we should delegate now the actions, and ctors.
  • Removes unneccessary files.
  1. Deleting SuperRpc server POC, creating the structure of the repository's rules for Process Explorer:
  • Removed SuperRpc POC solution,
  • Removed LocalColelctor usage from WpfDataGrid
  • Removed unneccessary files from ModulesPrototype example program, which was related to the Process Explorer
  • Moved files under the relevant structure under the TryOuts/Plugins/ApplicationPlugins/process explorer/dotnet-js folders.
  1. Renaming variables, arguments, server disposing fix, end-to-end tests initial, added IProcessManager, removed unnecessary files, changed ISubsystemLauncher and communicator API's
  • Renaming some methods
  • Added properties to the IProcessInfoAggregator, renamed some methods, and reorganized the structure of this interface.
  • Renamed some variables/arguments for better uderstanding: pid -> processId or ppid -> parentProcessId
  • API changes for ISubsystemLauncher which responsible for delegating the launch/stop requests for subsystems.
  • Removed prevously defined WebSocket solution as discussed.
  • Added SubscriptionIsAlive update message for IUiHandler to inform the connected uis that the subscription is alive.
  • Added some tests with FluentAssertions package
  • Added interface for IProcessInfoManager (later IProcessMonitor)
  1. Remove unnecessary methods, rename IProcessInfoManager to IProcessMonitor, null checks, added IClientConnection for tracking the clients, added WindowsProcessMonitorTests, SubsystemControllerTests, SubsystemLauncherTests, fix of EndToEndTests, added sample programs for test cases, remove unnecessary methods, renamed variables, factory method
  • Redesigned IUiHandler: to decrease the CPU usage for sending messages to the uis, and not generating the messages for every connected ui, I added an AddConnection and RemoveConnection to the interface, so now it have to store the connected clients and act .
  • Renamed IProcessInfoManager to IProcessMonitor and the derived classes.
  • SubsystemLauncher: checking in the Restart method if the stop request was successful.
  1. Fix CI jobs and tests
  • CI jobs dotnet test were taking the executables and files from the Debug folder -> added configuration: Release as we are building the files into the Release folder
  1. Using Assert methods instead of FluentAssertions package, npm i on ProcessExplorer frontend
  2. Remove LocalCollector dependency from Abstractions and Core package, moved the interfaces and entities under Abstraction package from LocalCollector.
    Fix EndToEndTests
  • Code Coverage report was not working with the Ecxeption: The process is being used by an anouther process. (LocalCollector.dll) -> Removed the dependency, reorganized the classes into the Abstractions project, later will revisit the LocalCollector project.
  1. Fix SetProcessIds test
  • Added Thread.Sleep method to wait for sure until the test application will start.
  1. ClientSubscription potential fix
  • Disposing the call properly

@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Merging #182 (8d607d8) into main (c5b6bca) will decrease coverage by 8.14%.
The diff coverage is 53.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
- Coverage   76.21%   68.07%   -8.14%     
==========================================
  Files          95      130      +35     
  Lines        3565     4530     +965     
  Branches      138      138              
==========================================
+ Hits         2717     3084     +367     
- Misses        847     1445     +598     
  Partials        1        1              
Impacted Files Coverage Δ
...bstractions/Entities/Connections/ConnectionInfo.cs 100.00% <ø> (ø)
...ions/Entities/Connections/ConnectionMonitorInfo.cs 0.00% <0.00%> (ø)
...Entities/Connections/ConnectionStatusExtensions.cs 0.00% <ø> (ø)
...plorer.Abstractions/Entities/Modules/ModuleInfo.cs 16.66% <ø> (ø)
...actions/Entities/Registrations/RegistrationInfo.cs 100.00% <ø> (ø)
...plorer.Abstractions/Entities/RuntimeInformation.cs 0.00% <ø> (ø)
...Explorer.Abstractions/Extensions/EnumExtensions.cs 0.00% <0.00%> (ø)
.../dotnet/src/ProcessExplorer.Abstractions/Module.cs 0.00% <0.00%> (ø)
...Explorer.Abstractions/Processes/ProcessInfoData.cs 0.00% <0.00%> (ø)
...xplorer.Core/Factories/ProcessAggregatorFactory.cs 0.00% <0.00%> (ø)
... and 25 more

... and 39 files with indirect coverage changes

@lilla28 lilla28 changed the title Pe/grpc Process Explorer -- Added Grpc Server Apr 5, 2023
@lilla28 lilla28 force-pushed the pe/grpc branch 3 times, most recently from b12646d to acdb894 Compare April 21, 2023 11:38
@lilla28 lilla28 marked this pull request as ready for review April 24, 2023 08:19
@lilla28 lilla28 requested a review from a team April 24, 2023 08:19
@lilla28 lilla28 marked this pull request as draft May 4, 2023 11:59
@lilla28 lilla28 marked this pull request as ready for review May 8, 2023 11:25
lilla28 and others added 12 commits May 10, 2023 14:20
…GRpcProcessExplorer server, renamed variables, implemented IDisposable for IProcessInfoAggregator and IProcessMonitor instances
… change, null checks for server implementation, delegating launch/stop/restart request
… initial, added IProcessManager, removed unnecessary files, changed ISubsystemLauncher and communicator API's
…itor, null checks, added IClientConnection for tracking the clients, added WindowsProcessMonitorTests, SubsystemControllerTests, SubsystemLauncherTests, fix of EndToEndTests, added sample programs for test cases, remove unnecessary methods, renamed variables, factory method
…moved the interfaces and entities under Abstraction package from LocalCollector.

Fix EndToEndTests
…essInfoMonitor, added some IEnumerable extension methods, added comments
ZKRobi
ZKRobi previously approved these changes May 22, 2023
@lilla28 lilla28 merged commit f9f9f1d into morganstanley:main May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants