metrics agent infrastructure

This commit is contained in:
Michael Quigley 2022-10-13 14:23:52 -04:00
parent 9d78e8e942
commit 462025f5fa
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 27 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import (
)
var str *store.Store
var mtr *metricsAgent
const version = "v0.2.0"
@ -43,6 +44,9 @@ func Run(cfg *Config) error {
return errors.Wrap(err, "error opening store")
}
mtr = newMetricsAgent(cfg.MetricsConfig)
go mtr.run()
server := rest_server_zrok.NewServer(api)
defer func() { _ = server.Shutdown() }()
server.Host = cfg.Endpoint.Host
@ -51,5 +55,6 @@ func Run(cfg *Config) error {
if err := server.Serve(); err != nil {
return errors.Wrap(err, "api server error")
}
return nil
}

View File

@ -1,5 +1,10 @@
package controller
import (
"github.com/sirupsen/logrus"
"time"
)
type MetricsConfig struct {
Influx *InfluxConfig
}
@ -10,3 +15,20 @@ type InfluxConfig struct {
Org string
Token string
}
type metricsAgent struct {
cfg *MetricsConfig
}
func newMetricsAgent(cfg *MetricsConfig) *metricsAgent {
return &metricsAgent{cfg: cfg}
}
func (mtr *metricsAgent) run() {
logrus.Info("starting")
defer logrus.Info("exiting")
for {
time.Sleep(24 * time.Hour)
}
}