diff --git a/exporter/collector/metrics.go b/exporter/collector/metrics.go index 809d76b9..679138f7 100644 --- a/exporter/collector/metrics.go +++ b/exporter/collector/metrics.go @@ -599,14 +599,18 @@ func (me *MetricsExporter) runWALReadAndExportLoop(ctx context.Context) { // do one last final read/export then return // otherwise the runner goroutine could leave some hanging metrics unexported for { - fmt.Println("Reading WAL final time") err := me.readWALAndExport(runCtx) if err != nil { - if !errors.Is(err, wal.ErrOutOfRange) { - me.obs.log.Error(fmt.Sprintf("error flushing remaining WAL entries: %+v", err)) + me.obs.log.Error(fmt.Sprintf("error flushing remaining WAL entries: %+v", err)) + if errors.Is(err, wal.ErrOutOfRange) { + break + } + if errors.Is(err, wal.ErrNotFound) { + if err2 := me.watchWALFile(ctx); err2 != nil { + me.obs.log.Error(fmt.Sprintf("error flushing remaining WAL entries: %+v", err2)) + break + } } - fmt.Println(err) - break } } return