Class HealthCheckResult
- Namespace
- FishMMO.Database.Npgsql.Monitoring.Health
- Assembly
- FishMMO-DB.dll
Contains the result of a database health check operation. Provides detailed information about database connectivity, performance, and any errors encountered.
public sealed class HealthCheckResult
- Inheritance
-
HealthCheckResult
- Inherited Members
Constructors
HealthCheckResult()
Initializes a new instance of the HealthCheckResult class with default values.
public HealthCheckResult()
Properties
ActiveConnections
Gets or sets the active connection count.
public long ActiveConnections { get; set; }
Property Value
ConnectionErrors
Gets or sets the connection error count.
public long ConnectionErrors { get; set; }
Property Value
DatabaseName
Gets or sets the name of the database that was checked.
public string DatabaseName { get; set; }
Property Value
ErrorCode
Gets or sets the error code if an error occurred during the health check.
public string ErrorCode { get; set; }
Property Value
Exception
Gets or sets the exception that occurred during the health check, if any.
public Exception Exception { get; set; }
Property Value
HasWarning
Gets or sets whether the health check passed but with warnings (e.g., slow response time).
public bool HasWarning { get; set; }
Property Value
IsConnected
Gets or sets whether the database connection was successfully established.
public bool IsConnected { get; set; }
Property Value
Message
Gets or sets a human-readable message describing the health check result.
public string Message { get; set; }
Property Value
PeakConnections
Gets or sets the peak connection count.
public long PeakConnections { get; set; }
Property Value
PoolExhaustionCount
Gets or sets the pool exhaustion count.
public long PoolExhaustionCount { get; set; }
Property Value
PoolHealthMessage
Gets or sets the pool health message.
public string PoolHealthMessage { get; set; }
Property Value
PoolHealthStatus
Gets or sets the pool health status based on utilization and error metrics.
public PoolHealthStatus PoolHealthStatus { get; set; }
Property Value
PoolInfo
Gets or sets information about the connection pool configuration.
public string PoolInfo { get; set; }
Property Value
PoolRequiresAction
Gets or sets whether the pool health requires immediate action.
public bool PoolRequiresAction { get; set; }
Property Value
PoolUtilizationPercent
Gets or sets the pool utilization percentage (0-100).
public double PoolUtilizationPercent { get; set; }
Property Value
ResponseTimeMs
Gets or sets the response time in milliseconds for the health check query.
public double ResponseTimeMs { get; set; }
Property Value
ServerAddress
Gets or sets the server address of the database.
public string ServerAddress { get; set; }
Property Value
Status
Gets or sets the overall health status of the database.
public HealthStatus Status { get; set; }
Property Value
TotalConnectionsCreated
Gets or sets the total connections created.
public long TotalConnectionsCreated { get; set; }
Property Value
Methods
Sanitize()
Creates a sanitized copy of the health check result suitable for external exposure. Redacts sensitive infrastructure details including database names, server addresses, connection pool details, and exception information.
public HealthCheckResult Sanitize()
Returns
- HealthCheckResult
A new HealthCheckResult with sensitive information redacted.
Remarks
Security: This method should be used when exposing health check results via public APIs, logging to external systems, or any scenario where the data may be accessible to unauthorized users.
Redacted Fields: - DatabaseName → "***" - ServerAddress → "***" - PoolInfo → Summary text without connection details - ErrorCode → "***" (if present) - Exception → null
Preserved Fields: - Status, Message, IsConnected, ResponseTimeMs - Connection metrics (counts and percentages) - Pool health indicators - HasWarning flag
ToString()
Returns a string representation of the health check result.
public override string ToString()
Returns
- string
A formatted string containing the key health check information.