From 9dedddda01b07ae7d37c393e700ed2242e34851a Mon Sep 17 00:00:00 2001 From: sh0rez Date: Mon, 5 Jun 2023 14:38:21 +0200 Subject: [PATCH] prometheusremotewrite: wal default nop-logger Initializes the WAL with a default nop logger, instead of previous nil which led to panics. --- exporter/prometheusremotewriteexporter/wal.go | 1 + exporter/prometheusremotewriteexporter/wal_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/exporter/prometheusremotewriteexporter/wal.go b/exporter/prometheusremotewriteexporter/wal.go index 1050dbfd9430..ab49ecad5e3c 100644 --- a/exporter/prometheusremotewriteexporter/wal.go +++ b/exporter/prometheusremotewriteexporter/wal.go @@ -86,6 +86,7 @@ func newWAL(walConfig *WALConfig, exportSink func(context.Context, []*prompb.Wri rNotify: make(chan struct{}), rWALIndex: &atomic.Uint64{}, wWALIndex: &atomic.Uint64{}, + log: zap.NewNop(), } return &wal, nil diff --git a/exporter/prometheusremotewriteexporter/wal_test.go b/exporter/prometheusremotewriteexporter/wal_test.go index 9d5b3b91e868..fdf942673fc8 100644 --- a/exporter/prometheusremotewriteexporter/wal_test.go +++ b/exporter/prometheusremotewriteexporter/wal_test.go @@ -114,6 +114,7 @@ func TestWAL_persist(t *testing.T) { pwal, err := newWAL(config, doNothingExportSink) require.Nil(t, err) + pwal.log = zap.Must(zap.NewDevelopment()) // 1. Write out all the entries. reqL := []*prompb.WriteRequest{