Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertSeverity ¶
type AlertSeverity int
AlertSeverity represents the severity of an alert
const ( AlertSeverityInfo AlertSeverity = iota AlertSeverityWarning AlertSeverityCritical AlertSeverityEmergency )
func (AlertSeverity) String ¶
func (s AlertSeverity) String() string
type MetricStatus ¶
type MetricStatus int
MetricStatus represents the status of a metric
const ( MetricStatusNormal MetricStatus = iota MetricStatusWarning MetricStatusCritical MetricStatusUnknown )
func (MetricStatus) String ¶
func (s MetricStatus) String() string
type MetricType ¶
type MetricType int
MetricType represents the type of metric
const ( MetricTypeCPU MetricType = iota MetricTypeMemory MetricTypeGoroutine MetricTypeBlock MetricTypeMutex MetricTypeCustom )
func (MetricType) String ¶
func (t MetricType) String() string
type PerformanceAlert ¶
type PerformanceAlert struct {
ID string `json:"id"`
Metric string `json:"metric"`
Type AlertType `json:"type"`
Severity AlertSeverity `json:"severity"`
Message string `json:"message"`
Value float64 `json:"value"`
Threshold float64 `json:"threshold"`
Timestamp time.Time `json:"timestamp"`
Labels map[string]string `json:"labels"`
Resolved bool `json:"resolved"`
ResolvedAt time.Time `json:"resolved_at,omitempty"`
}
PerformanceAlert represents a performance alert
type PerformanceMetric ¶
type PerformanceMetric struct {
Name string `json:"name"`
Type MetricType `json:"type"`
Value float64 `json:"value"`
Unit string `json:"unit"`
Threshold float64 `json:"threshold"`
Status MetricStatus `json:"status"`
Timestamp time.Time `json:"timestamp"`
Labels map[string]string `json:"labels"`
Description string `json:"description"`
}
PerformanceMetric represents a performance metric
type Profile ¶
type Profile struct {
ID string `json:"id"`
Name string `json:"name"`
Type ProfileType `json:"type"`
Data []byte `json:"data"`
Size int64 `json:"size"`
Duration time.Duration `json:"duration"`
Timestamp time.Time `json:"timestamp"`
Labels map[string]string `json:"labels"`
Description string `json:"description"`
}
Profile represents a performance profile
type ProfileType ¶
type ProfileType int
ProfileType represents the type of profile
const ( ProfileTypeCPU ProfileType = iota ProfileTypeMemory ProfileTypeGoroutine ProfileTypeBlock ProfileTypeMutex ProfileTypeTrace )
func (ProfileType) String ¶
func (t ProfileType) String() string
type Profiler ¶
type Profiler struct {
// contains filtered or unexported fields
}
Profiler provides comprehensive performance monitoring and profiling
func NewProfiler ¶
func NewProfiler(config ProfilerConfig) *Profiler
NewProfiler creates a new profiler
func (*Profiler) GetMetrics ¶
func (p *Profiler) GetMetrics() map[string]*PerformanceMetric
GetMetrics returns all performance metrics
func (*Profiler) GetProfile ¶
GetProfile returns a specific profile
func (*Profiler) GetProfiles ¶
GetProfiles returns all performance profiles
type ProfilerConfig ¶
type ProfilerConfig struct {
EnableCPUProfiling bool `yaml:"enable_cpu_profiling" default:"true"`
EnableMemoryProfiling bool `yaml:"enable_memory_profiling" default:"true"`
EnableGoroutineProfiling bool `yaml:"enable_goroutine_profiling" default:"true"`
EnableBlockProfiling bool `yaml:"enable_block_profiling" default:"true"`
EnableMutexProfiling bool `yaml:"enable_mutex_profiling" default:"true"`
ProfileInterval time.Duration `yaml:"profile_interval" default:"30s"`
ProfileDuration time.Duration `yaml:"profile_duration" default:"10s"`
EnableMetrics bool `yaml:"enable_metrics" default:"true"`
EnableAlerts bool `yaml:"enable_alerts" default:"true"`
CPUThreshold float64 `yaml:"cpu_threshold" default:"80.0"`
MemoryThreshold float64 `yaml:"memory_threshold" default:"80.0"`
GoroutineThreshold int `yaml:"goroutine_threshold" default:"1000"`
Logger logger.Logger `yaml:"-"`
Metrics shared.Metrics `yaml:"-"`
}
ProfilerConfig contains profiler configuration
Click to show internal directories.
Click to hide internal directories.