package
0.0.0-20240615164402-742bdff4c8c2
Repository: https://github.com/naive-x/utils.git
Documentation: pkg.go.dev
# README
Mem Guardian Usage Guide
Environment Variables
MEMGUARDIAN
: Enable or disable memguardian. Set to 1 to enableMEMGUARDIAN_MAX_RAM_RATIO
: Maximum ram ratio from 1 to 100MEMGUARDIAN_MAX_RAM
: Maximum amount of RAM (in size units ex: 10gb)MEMGUARDIAN_INTERVAL
: detection interval (with unit ex: 30s)
How to Use
- Set the environment variables as per your requirements.
export MEMGUARDIAN=1
export MEMGUARDIAN_MAX_RAM_RATIO=75 # default
export MEMGUARDIAN_MAX_RAM=6Gb # optional
export MEMGUARDIAN_INTERVAL=30s # default
- Run your Go application. The profiler will start automatically if MEMGUARDIAN is set to 1.
# Functions
No description provided by the author
New mem guadian instance with user defined options.
Calculate the system absolute ratio of used RAM.
WithCallback defines an optional callback if the warning ration is exceeded.
WithMaxRamAmountWarning defines the max amount of used RAM in bytes threshold of the warning state (and optional callback invocation).
WithMaxRamRatioWarning defines the ratio (1-100) threshold of the warning state (and optional callback invocation).
WithInterval defines the ticker interval of the memory monitor.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author