fdmonitor

package
v0.74.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package fdmonitor monitors open file descriptor counts for the current process and logs warnings when configurable thresholds are exceeded.

Index

Constants

View Source
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

func Check(logger *slog.Logger) (count int, warned bool)

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

func CheckWithContext(logger *slog.Logger, context string) (count int, warned bool)

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

func DebugInfo() map[string]int

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL