-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add Enhanced Diagnostic Dump Feature, Suspend-PodeServer and Resume-PodeServer #1443
base: develop
Are you sure you want to change the base?
Conversation
src/Private/Helpers.ps1
Fixed
# Invoke the method | ||
$methodInfo.Invoke($Runspace.Debugger, @($eventArgs)) | ||
|
||
Write-Host "DebuggerStopEvent raised successfully." |
Check warning
Code scanning / PSScriptAnalyzer
File 'Helpers.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information. Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdaneri There's a fair few comments, but the most important ones are for the DebuggerHandler class, so I would recommend reading those first.
Description
This pull request introduces two new features for enhanced server control: Suspend/Resume functionality and Diagnostic Dumping.
Suspend-PodeServer
andResume-PodeServer
, allow you to temporarily suspend and resume all server operations without a full restart.Invoke-PodeDump
function is introduced to capture detailed diagnostic information during critical failures or fatal exceptions within Pode.Key Features
1. Suspend and Resume Pode Server Operations
The suspend and resume functions provide a way to temporarily pause and later resume all activities on the Pode server, including all associated runspaces. This can be helpful for:
Debugging: Pause execution without requiring a full server restart.
Maintenance: Briefly suspend server activities for quick maintenance tasks.
Performance Throttling: Temporarily halt server activities during high load, if necessary.
Suspend-PodeServer
: Pauses all runspaces associated with the Pode server. It ensures that runspaces enter a debug-like state, preventing the server from processing requests during suspension.-Timeout
parameter can be used to specify the maximum wait time for each runspace to suspend.Resume-PodeServer
: Resumes server activities by restoring all runspaces back to their normal execution state.2. Diagnostic Dumping with
Invoke-PodeDump
The
Invoke-PodeDump
function is designed to capture detailed diagnostic information during critical failures, enhancing Pode's error handling and debugging workflows.ErrorRecord
parameter accepts pipeline input, making it easy to integrate within try-catch blocks.Path
andFormat
, with default settings configurable inserver.psd1
.-Halt
switch terminates the application after saving the dump, useful for managing fatal errors requiring shutdown.Configuration in
server.psd1
The
server.psd1
configuration file supports default options forInvoke-PodeDump
, making it adaptable for various environments:Example Usage
Basic Suspend and Resume Usage:
Diagnostic Dump with Application Halt (JSON format):
Custom Diagnostic Dump Configuration Override (YAML format, custom path):
Notes