diff --git a/tsdb/db.go b/tsdb/db.go index ab0822d73..0678a6ea9 100644 --- a/tsdb/db.go +++ b/tsdb/db.go @@ -888,7 +888,9 @@ func (db *DB) Compact() (returnErr error) { db.cmtx.Lock() defer db.cmtx.Unlock() defer func() { - if returnErr != nil { + if returnErr != nil && !errors.Is(returnErr, context.Canceled) { + // If we got an error because context was canceled then we're most likely + // shutting down TSDB and we don't need to report this on metrics db.metrics.compactionsFailed.Inc() } }()