Documentation
¶
Overview ¶
Package fdmonitor monitors open file descriptor counts for the current process and logs warnings when configurable thresholds are exceeded.
Index ¶
Constants ¶
const ( // DefaultWarningThreshold is the FD count that triggers a warning. DefaultWarningThreshold = 200 // DefaultCriticalThreshold is the FD count that triggers a critical warning. DefaultCriticalThreshold = 500 // MinCheckInterval prevents checking too frequently. MinCheckInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check checks the current FD count and logs a warning if it exceeds thresholds. To avoid log spam, checks are rate-limited to MinCheckInterval. Returns the current FD count and whether a warning was logged.
func CheckWithContext ¶
CheckWithContext checks FD count and includes context about what triggered the check.
func Count ¶
func Count() int
Count returns the current number of open file descriptors for this process. On non-Linux/macOS platforms, returns -1.
func DebugInfo ¶
DebugInfo returns detailed FD information for debugging. On non-Linux/macOS platforms, returns an empty map.
func SetThresholds ¶
func SetThresholds(warning, critical int)
SetThresholds configures the warning and critical thresholds.
func Thresholds ¶
func Thresholds() (warning, critical int)
Thresholds returns the current warning and critical thresholds.
Types ¶
This section is empty.