Interface ITimeoutMonitor
Monitors timeout events and provides timeout statistics for adaptive timeout calculations. Timeout monitoring and adaptive timeout management.
public interface ITimeoutMonitor
- Extension Methods
Methods
ClearStatistics(TimeoutOperationType?)
Clears timeout statistics for a specific operation type or all operations.
void ClearStatistics(TimeoutOperationType? operationType = null)
Parameters
operationTypeTimeoutOperationType?The operation type to clear statistics for, or null for all operations.
CompleteOperation(ITimeoutOperationToken, bool, bool)
Records the completion of an operation.
void CompleteOperation(ITimeoutOperationToken token, bool success, bool timedOut)
Parameters
tokenITimeoutOperationTokenThe monitoring token from StartOperation.
successboolWhether the operation completed successfully.
timedOutboolWhether the operation timed out.
GetRecommendedTimeout(TimeoutOperationType, int, TimeoutContext?)
Gets the recommended timeout for an operation based on historical data.
TimeSpan GetRecommendedTimeout(TimeoutOperationType operationType, int percentile = 95, TimeoutContext? context = null)
Parameters
operationTypeTimeoutOperationTypeThe operation type to get a recommendation for.
percentileintThe percentile to use for the recommendation (e.g., 95 for 95th percentile).
contextTimeoutContextAdditional context for the recommendation.
Returns
- TimeSpan
The recommended timeout duration.
GetSampleCount(TimeoutOperationType)
Gets the number of samples collected for an operation type.
int GetSampleCount(TimeoutOperationType operationType)
Parameters
operationTypeTimeoutOperationTypeThe operation type to get sample count for.
Returns
- int
The number of samples collected.
GetStatistics(TimeoutOperationType)
Gets timeout statistics for a specific operation type.
TimeoutStatistics GetStatistics(TimeoutOperationType operationType)
Parameters
operationTypeTimeoutOperationTypeThe operation type to get statistics for.
Returns
- TimeoutStatistics
Timeout statistics for the operation type.
HasSufficientSamples(TimeoutOperationType, int)
Determines if enough samples have been collected for reliable adaptive timeout calculations.
bool HasSufficientSamples(TimeoutOperationType operationType, int minimumSamples = 100)
Parameters
operationTypeTimeoutOperationTypeThe operation type to check.
minimumSamplesintThe minimum number of samples required.
Returns
- bool
True if enough samples have been collected; otherwise, false.
StartOperation(TimeoutOperationType, TimeoutContext?)
Records the start of an operation for timeout monitoring.
ITimeoutOperationToken StartOperation(TimeoutOperationType operationType, TimeoutContext? context = null)
Parameters
operationTypeTimeoutOperationTypeThe type of operation being monitored.
contextTimeoutContextAdditional context for the operation.
Returns
- ITimeoutOperationToken
A monitoring token to track the operation.