refactor: move models to their own package to use the same as in the importer
This commit is contained in:
parent
553a85562b
commit
9aa1b7384d
14 changed files with 170 additions and 152 deletions
|
|
@ -4,9 +4,10 @@ import (
|
|||
"context"
|
||||
"log/slog"
|
||||
"time"
|
||||
"tixel_watch/models"
|
||||
)
|
||||
|
||||
func (smc *SystemMetricsCollector) StartV2(ctx context.Context, storage StorageInterface, logChan chan<- LogEntry) {
|
||||
func (smc *SystemMetricsCollector) StartV2(ctx context.Context, storage StorageInterface, logChan chan<- models.LogMessage) {
|
||||
ticker := time.NewTicker(time.Duration(smc.pollInterval) * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
|
|
@ -22,7 +23,7 @@ func (smc *SystemMetricsCollector) StartV2(ctx context.Context, storage StorageI
|
|||
continue
|
||||
}
|
||||
|
||||
entry := NewLogEntry("system_metrics")
|
||||
entry := models.NewLogMessage("system_metrics", hostname)
|
||||
entry.Service = "system-metrics"
|
||||
entry.LogLevel = "Info"
|
||||
entry.SystemMetrics = metrics
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue