Skip to content

Commit

Permalink
feat: add metrics retrieval to updateUI and pass metrics to HMAC table
Browse files Browse the repository at this point in the history
  • Loading branch information
PlusOne committed Jan 1, 2025
1 parent ef94f4b commit 98936fe
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ func updateUI(ctx context.Context, app *tview.Application, pages *tview.Pages, s
err error
})
hmacInfoCh := make(chan struct {
info *ProcessInfo
err error
info *ProcessInfo
metrics map[string]float64
err error
})

// Goroutine zur Datenbeschaffung
Expand Down Expand Up @@ -472,10 +473,15 @@ func updateUI(ctx context.Context, app *tview.Application, pages *tview.Pages, s
// hmac-file-server Informationen abrufen asynchron
go func() {
hmacInfo, err := fetchHmacFileServerInfo()
var metrics map[string]float64
if metricsEnabled {
metrics, err = fetchMetrics()
}
hmacInfoCh <- struct {
info *ProcessInfo
err error
}{hmacInfo, err}
info *ProcessInfo
metrics map[string]float64
err error
}{hmacInfo, metrics, err}
}()
}
}
Expand Down Expand Up @@ -550,7 +556,7 @@ func updateUI(ctx context.Context, app *tview.Application, pages *tview.Pages, s
if currentPage, _ := pages.GetFrontPage(); currentPage == "hmac" && data.info != nil {
hmacFlex := hmacPage.(*tview.Flex)
hmacTable := hmacFlex.GetItem(0).(*tview.Table)
updateHmacTable(hmacTable, data.info, nil) // Metriken können separat behandelt werden
updateHmacTable(hmacTable, data.info, data.metrics)
}
})
}
Expand Down

0 comments on commit 98936fe

Please sign in to comment.