3 Commits

2 changed files with 2 additions and 10 deletions

View File

@@ -6,7 +6,6 @@ import (
"io"
"log/slog"
"os"
"sync"
"time"
"github.com/ncw/directio"
@@ -33,10 +32,7 @@ func NewExporter(conf *Config, alloc *Alloc, metrics *Metrics) *Exporter {
}
// starts the primary go-routine, which will run the io checks for ever
func (exp *Exporter) RunIOchecks() *sync.WaitGroup {
var wg sync.WaitGroup
wg.Add(1)
func (exp *Exporter) RunIOchecks() {
go func() {
for {
var res_r, res_w Result
@@ -64,8 +60,6 @@ func (exp *Exporter) RunIOchecks() *sync.WaitGroup {
time.Sleep(time.Duration(exp.conf.Sleeptime) * time.Second)
}
}()
return &wg
}
// call an io measurement and collect time needed

View File

@@ -31,7 +31,7 @@ func Run() {
alloc := NewAlloc()
exporter := NewExporter(conf, alloc, metrics)
wg := exporter.RunIOchecks()
exporter.RunIOchecks()
http.Handle("/metrics", promhttp.HandlerFor(
metrics.registry,
@@ -49,8 +49,6 @@ func Run() {
if err := http.ListenAndServe(fmt.Sprintf(":%d", conf.Port), nil); err != nil {
log.Fatal(err)
}
wg.Wait()
}
func report(err error, fd *os.File) bool {