Update
This commit is contained in:
parent
d37503c863
commit
1509789cde
19 changed files with 1534 additions and 112 deletions
|
|
@ -89,11 +89,15 @@ type StatusCodesByState struct {
|
|||
Pending int `json:"pending"`
|
||||
}
|
||||
|
||||
// StorageConfig configures the in-memory ring buffer and optional disk persistence.
|
||||
// StorageConfig configures the in-memory ring buffer, long-term history
|
||||
// logging, the stats database, and optional state persistence.
|
||||
type StorageConfig struct {
|
||||
HistorySize int `json:"history_size"`
|
||||
PersistenceFile string `json:"persistence_file,omitempty"`
|
||||
SaveInterval Duration `json:"save_interval,omitempty"`
|
||||
HistorySize int `json:"history_size"`
|
||||
PersistenceFile string `json:"persistence_file,omitempty"`
|
||||
SaveInterval Duration `json:"save_interval,omitempty"`
|
||||
LogsDir string `json:"logs_dir,omitempty"`
|
||||
StatsDB string `json:"stats_db,omitempty"`
|
||||
StatsRetentionDays int `json:"stats_retention_days,omitempty"`
|
||||
}
|
||||
|
||||
// DefaultsConfig provides global fallback check intervals and thresholds.
|
||||
|
|
@ -362,9 +366,12 @@ func DefaultConfig() Config {
|
|||
},
|
||||
},
|
||||
Storage: StorageConfig{
|
||||
HistorySize: 60,
|
||||
PersistenceFile: "",
|
||||
SaveInterval: NewDuration(1 * time.Minute),
|
||||
HistorySize: 60,
|
||||
PersistenceFile: "",
|
||||
SaveInterval: NewDuration(1 * time.Minute),
|
||||
LogsDir: "logs",
|
||||
StatsDB: "stats.db",
|
||||
StatsRetentionDays: 90,
|
||||
},
|
||||
Defaults: DefaultsConfig{
|
||||
Interval: NewDuration(15 * time.Second),
|
||||
|
|
@ -611,6 +618,15 @@ func (c *Config) ApplyFallbacks() {
|
|||
if c.Storage.SaveInterval <= 0 {
|
||||
c.Storage.SaveInterval = NewDuration(1 * time.Minute)
|
||||
}
|
||||
if c.Storage.LogsDir == "" {
|
||||
c.Storage.LogsDir = "logs"
|
||||
}
|
||||
if c.Storage.StatsDB == "" {
|
||||
c.Storage.StatsDB = "stats.db"
|
||||
}
|
||||
if c.Storage.StatsRetentionDays <= 0 {
|
||||
c.Storage.StatsRetentionDays = 90
|
||||
}
|
||||
|
||||
if c.Defaults.Interval <= 0 {
|
||||
c.Defaults.Interval = NewDuration(30 * time.Second)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue