Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
Timestamp time.Time `json:"timestamp"`
Metadata map[string]any `json:"metadata"`
ID string `json:"id"`
Type string `json:"type"`
Severity Severity `json:"severity"`
Message string `json:"message"`
}
Alert represents an alert
type AlertAction ¶
AlertAction defines alert actions
type AlertManager ¶
type AlertManager struct {
// contains filtered or unexported fields
}
AlertManager manages alerts
func NewAlertManager ¶
func NewAlertManager() *AlertManager
NewAlertManager creates a new alert manager
func (*AlertManager) GetAlertChannel ¶
func (am *AlertManager) GetAlertChannel() <-chan Alert
GetAlertChannel returns the alert channel
func (*AlertManager) TriggerAlert ¶
func (am *AlertManager) TriggerAlert(alert Alert)
TriggerAlert triggers an alert
type AlertRule ¶
type AlertRule struct {
Name string `json:"name"`
SLOName string `json:"slo_name"`
Condition string `json:"condition"`
Severity Severity `json:"severity"`
Actions []AlertAction `json:"actions"`
Threshold float64 `json:"threshold"`
Duration time.Duration `json:"duration"`
Enabled bool `json:"enabled"`
}
AlertRule defines alerting rules
type MetricCollector ¶
type MetricCollector interface {
CollectMetrics(ctx context.Context) ([]MetricDataPoint, error)
GetMetricType() SLOType
}
MetricCollector interface for collecting metrics
type MetricDataPoint ¶
type MetricDataPoint struct {
Timestamp time.Time `json:"timestamp"`
Tags map[string]string `json:"tags,omitempty"`
Value float64 `json:"value"`
}
MetricDataPoint represents a metric data point
type ReportConfig ¶
type ReportConfig struct {
Format string `json:"format"`
Template string `json:"template"`
Recipients []string `json:"recipients"`
Frequency time.Duration `json:"frequency"`
Enabled bool `json:"enabled"`
}
ReportConfig defines reporting configuration
type ReportGenerator ¶
type ReportGenerator struct{}
ReportGenerator generates reports
func NewReportGenerator ¶
func NewReportGenerator() *ReportGenerator
NewReportGenerator creates a new report generator
func (*ReportGenerator) GenerateSLAReport ¶
func (rg *ReportGenerator) GenerateSLAReport(metrics map[string]*SLAMetrics) []byte
GenerateSLAReport generates an SLA report
type SLAConfig ¶
type SLAConfig struct {
ApplicationName string `json:"application_name"`
Environment string `json:"environment"`
SLOs []SLO `json:"slos"`
AlertRules []AlertRule `json:"alert_rules"`
Reporting ReportConfig `json:"reporting"`
Thresholds ThresholdConfig `json:"thresholds"`
}
SLAConfig holds SLA configuration
type SLAMetrics ¶
type SLAMetrics struct {
LastUpdated time.Time `json:"last_updated"`
SLOName string `json:"slo_name"`
Status SLAStatus `json:"status"`
History []MetricDataPoint `json:"history"`
Violations []SLAViolation `json:"violations"`
CurrentValue float64 `json:"current_value"`
Target float64 `json:"target"`
ErrorBudget float64 `json:"error_budget"`
BurnRate float64 `json:"burn_rate"`
}
SLAMetrics holds SLA metrics
type SLAMonitor ¶
type SLAMonitor struct {
// contains filtered or unexported fields
}
SLAMonitor manages Service Level Agreement monitoring
func NewSLAMonitor ¶
func NewSLAMonitor(config SLAConfig) *SLAMonitor
NewSLAMonitor creates a new SLA monitor
func (*SLAMonitor) GetMetrics ¶
func (sm *SLAMonitor) GetMetrics() map[string]*SLAMetrics
GetMetrics returns current SLA metrics
func (*SLAMonitor) GetSLOStatus ¶
func (sm *SLAMonitor) GetSLOStatus(sloName string) (*SLAMetrics, error)
GetSLOStatus returns status of a specific SLO
func (*SLAMonitor) RegisterCollector ¶
func (sm *SLAMonitor) RegisterCollector(name string, collector MetricCollector)
RegisterCollector registers a metric collector
type SLAViolation ¶
type SLAViolation struct {
Timestamp time.Time `json:"timestamp"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
ID string `json:"id"`
SLOName string `json:"slo_name"`
Severity Severity `json:"severity"`
Description string `json:"description"`
Duration time.Duration `json:"duration"`
ActualValue float64 `json:"actual_value"`
TargetValue float64 `json:"target_value"`
Resolved bool `json:"resolved"`
}
SLAViolation represents an SLA violation
type SLO ¶
type SLO struct {
Type SLOType `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Target float64 `json:"target"`
Window time.Duration `json:"window"`
Critical bool `json:"critical"`
Enabled bool `json:"enabled"`
}
SLO represents a Service Level Objective
type ThresholdConfig ¶
type ThresholdConfig struct {
WarningThreshold float64 `json:"warning_threshold"`
CriticalThreshold float64 `json:"critical_threshold"`
ErrorBudgetAlert float64 `json:"error_budget_alert"`
}
ThresholdConfig defines threshold configuration