mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 20:58:14 -05:00
feat: add index on monitor history (#320)
This commit is contained in:
parent
5bd4b57cbf
commit
7d38634933
@ -1,20 +1,22 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
const (
|
import (
|
||||||
Cycle = iota
|
"time"
|
||||||
Hour
|
|
||||||
Day
|
"gorm.io/gorm"
|
||||||
Week
|
|
||||||
Month
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MonitorHistory 历史监控记录
|
// MonitorHistory 历史监控记录
|
||||||
type MonitorHistory struct {
|
type MonitorHistory struct {
|
||||||
Common
|
ID uint64 `gorm:"primaryKey"`
|
||||||
MonitorID uint64
|
CreatedAt time.Time `gorm:"index;<-:create;index:idx_server_id_created_at_monitor_id_avg_delay"`
|
||||||
ServerID uint64
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||||
AvgDelay float32 // 平均延迟,毫秒
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||||
|
MonitorID uint64 `gorm:"index:idx_server_id_created_at_monitor_id_avg_delay"`
|
||||||
|
ServerID uint64 `gorm:"index:idx_server_id_created_at_monitor_id_avg_delay"`
|
||||||
|
AvgDelay float32 `gorm:"index:idx_server_id_created_at_monitor_id_avg_delay"` // 平均延迟,毫秒
|
||||||
Up uint64 // 检查状态良好计数
|
Up uint64 // 检查状态良好计数
|
||||||
Down uint64 // 检查状态异常计数
|
Down uint64 // 检查状态异常计数
|
||||||
Data string
|
Data string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user