clear
Drop every metric series this exporter holds and delete its five persisted keys (#2208).
Local-only, and it cannot be otherwise. GCounter and HyperLogLog are monotonic join-semilattices: a merge takes the element-wise maximum, so a peer holding the pre-clear state restores it. LWWRegister has no "cleared" value to write. Unlike WarpLogRecordExporter.clear and WarpSpanExporter.clear, which suppress the state they drop, this one only forgets it locally. On a replica that does not gossip its metrics — the case this exists for — the distinction never arises.
The keys are deleted rather than rewritten empty: there is no retained context to preserve here, so deleting reclaims the bytes and recover treats an absent key as empty.
Never throws. A refused delete returns MetricWriteResult.Failure; the in-memory maps are cleared either way, so a retry converges. No kind owes a read after a clear, so a kind whose delete was refused is not read back by its own next write, which replaces what the delete left and so finishes the clear for that kind. Until that write lands the dropped series are still on disk, though: a recover called before it reads them back into memory, where the kind's next write persists them again, and so does the first recover after a restart. Retrying the clear until it returns MetricWriteResult.Success is what removes them.
Its failure line is not deduplicated against the durable-write outage latch, and that is deliberate on both arms: a clear is caller-initiated rather than retried, so it cannot produce the unbounded volume #2593 is about; and a store that takes a delete has proven nothing about whether it will take a write, so letting a refused delete open — or close — that latch would let one path silence the other. See durableWriteOutage.
Holds writeMutex across the whole turn, so a mutation that encoded the pre-clear map cannot land its stale bytes after the deletes. Without that fence the resurrection is permanent: nothing rewrites a deleted key unless that metric kind is used afresh, so a restart brings back every pre-clear series (#2232).