core

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateHealthScore

func CalculateHealthScore(serviceStats *models.ServiceStats) (*models.SystemHealthInPercent, error)

CalculateHealthScore calculates the health score of both the system and service

func CalculateOverallLoad

func CalculateOverallLoad(serviceCPU, serviceMem string) string

Function to calculate overall load

func CollectGoRoutinesInfo

func CollectGoRoutinesInfo() models.GoRoutinesStatistic

CollectGoRoutinesInfo returns the number of running Go routines and their stack traces split into separate goroutine blocks.

func ConfigureServiceThresholds

func ConfigureServiceThresholds(thresholdsValues *models.ServiceHealthThresholds)

SetServiceThresholds sets the service thresholds to calculate the overall service health.

func ConstructMemStats

func ConstructMemStats(memStats *runtime.MemStats) []models.Record

ConstructMemStats constructs a list of memory statistics records.

func ConstructRawMemStats

func ConstructRawMemStats(memStats *runtime.MemStats) []models.RawMemStatsRecords

ConstructRawMemStats constructs a list of raw memory statistics records.

func FunctionTraceDetails added in v0.0.2

func FunctionTraceDetails() map[string]*models.FunctionMetrics

FunctionTraceDetails returns the function trace details

func GetCPUPrecent

func GetCPUPrecent() float64

GetRequestCount returns the total number of requests

func GetCPUStatistics

func GetCPUStatistics() models.CPUStatistics

GetCPUStatistics retrieves the CPU statistics.

func GetCoreStatistics

func GetCoreStatistics() models.CoreStatistics

GetCoreStatistics retrieves core statistics like goroutines, request count, uptime, and total request duration

func GetLoadStatistics

func GetLoadStatistics() models.LoadStatistics

GetLoadStatistics retrieves load statistics for CPU, memory, and optionally disk usage.

func GetMemoryStatistics

func GetMemoryStatistics() models.MemoryStatistics

GetMemoryStatistics retrieves memory statistics.

func GetNetworkIO

func GetNetworkIO() (float64, float64)

GetNetworkIO retrieves network I/O statistics.

func GetServiceHealth

func GetServiceHealth(serviceStats *models.ServiceStats) models.ServiceHealth

GetServiceHealth retrieves the service health statistics.

func GetServiceStats

func GetServiceStats() models.ServiceStats

GetServiceStats collects statistics related to service and system performance.

func GetVirtualMemoryStats

func GetVirtualMemoryStats() mem.VirtualMemoryStat

GetVirtualMemoryStats returns the virtual memory statistics

func ReadMemStats

func ReadMemStats() *runtime.MemStats

ReadMemStats reads and returns the memory statistics

func SplitGoroutines

func SplitGoroutines(stackTrace string) []string

SplitGoroutines splits the input stack trace into separate goroutine blocks based on new lines and "goroutine" identifiers.

func StartCPUProfile

func StartCPUProfile(filename string) (*os.File, error)

StartCPUProfile starts the CPU profile and writes it to the specified file.

func StopCPUProfile

func StopCPUProfile(f *os.File)

StopCPUProfile stops the current CPU profile and writes it to the specified file.

func TraceFunction added in v0.0.2

func TraceFunction(f func())

TraceFunction traces the function and captures the metrics

func ViewFunctionMetrics added in v0.0.2

func ViewFunctionMetrics(name, reportType string, metrics *models.FunctionMetrics) models.FunctionTraceDetails

ViewFunctionMetrics generates the function metrics

func WriteHeapProfile

func WriteHeapProfile(filename string) error

WriteHeapProfile writes the current memory heap profile to the specified file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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