Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableMemoryLogs ¶
func EnableMemoryLogs(enabled bool)
EnableMemoryLogs enables memory tracking logs
func IsMemoryLogsEnabled ¶
func IsMemoryLogsEnabled() bool
IsMemoryLogsEnabled returns whether memory logs are enabled
func LogMemoryAndMessageSize ¶
func LogMemoryAndMessageSize(ctx context.Context, stage string, messageSize int, additionalAttrs ...utils.Attribute)
LogMemoryAndMessageSize logs memory stats and message size with context
func StartMemoryGC ¶
StartMemoryGC starts a goroutine that monitors heap memory usage and calls GC when heap in use exceeds the threshold. If thresholdGB is 0, the routine is disabled. The goroutine runs until ctx is cancelled.
Types ¶
type MemoryProfiler ¶
type MemoryProfiler struct {
// contains filtered or unexported fields
}
MemoryProfiler helps track memory changes over time
func NewMemoryProfiler ¶
func NewMemoryProfiler() *MemoryProfiler
NewMemoryProfiler creates a new memory profiler
func (*MemoryProfiler) GetDelta ¶
func (mp *MemoryProfiler) GetDelta() map[string]interface{}
GetDelta returns the change in memory since profiler creation
type MemoryStats ¶
type MemoryStats struct {
AllocMB float64
TotalAllocMB float64
SysMB float64
NumGC uint32
HeapAllocMB float64
HeapSysMB float64
HeapIdleMB float64
HeapInUseMB float64
StackInUseMB float64
GoroutineCount int
}
MemoryStats holds current memory statistics
func GetMemoryStats ¶
func GetMemoryStats() *MemoryStats
GetMemoryStats returns current memory statistics
Click to show internal directories.
Click to hide internal directories.