Persist time series viewer metrics (#1752)
* WIP persisting time series viewer metrics. Closes #1478 * Remove unused var, move around initial collection
This commit is contained in:
@@ -13,15 +13,11 @@ import (
|
||||
// How often we poll for updates.
|
||||
const metricsPollingInterval = 1 * time.Minute
|
||||
|
||||
var _getStatus func() models.Status
|
||||
|
||||
// CollectedMetrics stores different collected + timestamped values.
|
||||
type CollectedMetrics struct {
|
||||
CPUUtilizations []timestampedValue `json:"cpu"`
|
||||
RAMUtilizations []timestampedValue `json:"memory"`
|
||||
DiskUtilizations []timestampedValue `json:"disk"`
|
||||
|
||||
Viewers []timestampedValue `json:"-"`
|
||||
}
|
||||
|
||||
// Metrics is the shared Metrics instance.
|
||||
@@ -29,8 +25,6 @@ var Metrics *CollectedMetrics
|
||||
|
||||
// Start will begin the metrics collection and alerting.
|
||||
func Start(getStatus func() models.Status) {
|
||||
_getStatus = getStatus
|
||||
|
||||
host := data.GetServerURL()
|
||||
if host == "" {
|
||||
host = "unknown"
|
||||
@@ -72,7 +66,6 @@ func Start(getStatus func() models.Status) {
|
||||
|
||||
Metrics = new(CollectedMetrics)
|
||||
go startViewerCollectionMetrics()
|
||||
handlePolling()
|
||||
|
||||
for range time.Tick(metricsPollingInterval) {
|
||||
handlePolling()
|
||||
|
||||
Reference in New Issue
Block a user