Documentation
¶
Index ¶
- type Alert
- type AlertChannel
- type AlertLevel
- type AlertManager
- type AlertRule
- type LogAlertChannel
- type MetricsCollector
- type MonitoringManager
- func (mm *MonitoringManager) RecordError(errorType string)
- func (mm *MonitoringManager) RecordMessage(messageType string)
- func (mm *MonitoringManager) RecordRequestDuration(method, endpoint string, duration time.Duration)
- func (mm *MonitoringManager) SetActorCount(count int)
- func (mm *MonitoringManager) SetConnectionCount(count int)
- func (mm *MonitoringManager) Start() error
- func (mm *MonitoringManager) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
ID string
Rule string
Level AlertLevel
Message string
Timestamp time.Time
NodeID string
NodeType string
}
Alert 告警
type AlertLevel ¶
type AlertLevel int
AlertLevel 告警级别
const ( AlertLevelInfo AlertLevel = iota AlertLevelWarning AlertLevelError AlertLevelCritical )
type AlertManager ¶
type AlertManager struct {
// contains filtered or unexported fields
}
AlertManager 告警管理器
func (*AlertManager) AddChannel ¶
func (am *AlertManager) AddChannel(channel AlertChannel)
AddChannel 添加告警通道
func (*AlertManager) CheckRules ¶
func (am *AlertManager) CheckRules(nodeID, nodeType string)
CheckRules 检查告警规则
func (*AlertManager) GetRecentAlerts ¶
func (am *AlertManager) GetRecentAlerts(limit int) []Alert
GetRecentAlerts 获取最近的告警
type AlertRule ¶
type AlertRule struct {
Name string
Condition func() bool
Message string
Level AlertLevel
Cooldown time.Duration
LastAlert time.Time
}
AlertRule 告警规则
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector 指标收集器
func NewMetricsCollector ¶
func NewMetricsCollector(nodeID, nodeType string) (*MetricsCollector, error)
NewMetricsCollector 创建指标收集器
func (*MetricsCollector) Collect ¶
func (mc *MetricsCollector) Collect(ch chan<- prometheus.Metric)
Collect 实现prometheus.Collector接口
func (*MetricsCollector) Describe ¶
func (mc *MetricsCollector) Describe(ch chan<- *prometheus.Desc)
Describe 实现prometheus.Collector接口
type MonitoringManager ¶
type MonitoringManager struct {
// contains filtered or unexported fields
}
MonitoringManager 监控管理器
func NewMonitoringManager ¶
func NewMonitoringManager(nodeID, nodeType string, port int) (*MonitoringManager, error)
NewMonitoringManager 创建监控管理器
func (*MonitoringManager) RecordError ¶
func (mm *MonitoringManager) RecordError(errorType string)
RecordError 记录错误指标
func (*MonitoringManager) RecordMessage ¶
func (mm *MonitoringManager) RecordMessage(messageType string)
RecordMessage 记录消息指标
func (*MonitoringManager) RecordRequestDuration ¶
func (mm *MonitoringManager) RecordRequestDuration(method, endpoint string, duration time.Duration)
RecordRequestDuration 记录请求时长
func (*MonitoringManager) SetActorCount ¶
func (mm *MonitoringManager) SetActorCount(count int)
SetActorCount 设置Actor数量
func (*MonitoringManager) SetConnectionCount ¶
func (mm *MonitoringManager) SetConnectionCount(count int)
SetConnectionCount 设置连接数
Click to show internal directories.
Click to hide internal directories.