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 `default:"true" yaml:"enable_cpu_profiling"`
EnableMemoryProfiling bool `default:"true" yaml:"enable_memory_profiling"`
EnableGoroutineProfiling bool `default:"true" yaml:"enable_goroutine_profiling"`
EnableBlockProfiling bool `default:"true" yaml:"enable_block_profiling"`
EnableMutexProfiling bool `default:"true" yaml:"enable_mutex_profiling"`
ProfileInterval time.Duration `default:"30s" yaml:"profile_interval"`
ProfileDuration time.Duration `default:"10s" yaml:"profile_duration"`
EnableMetrics bool `default:"true" yaml:"enable_metrics"`
EnableAlerts bool `default:"true" yaml:"enable_alerts"`
CPUThreshold float64 `default:"80.0" yaml:"cpu_threshold"`
MemoryThreshold float64 `default:"80.0" yaml:"memory_threshold"`
GoroutineThreshold int `default:"1000" yaml:"goroutine_threshold"`
Logger logger.Logger `yaml:"-"`
Metrics shared.Metrics `yaml:"-"`
}
ProfilerConfig contains profiler configuration.
Click to show internal directories.
Click to hide internal directories.