prometheus/web/api
Arve Knudsen c65189cc44 tsdb/seriesmetadata: sorted-slice inverted index with copy-on-write
Replace map[uint64]struct{} inner maps in the resource attribute
inverted index with sorted []uint64 slices using copy-on-write
semantics. This reduces memory ~4x (8 bytes/entry vs ~50 bytes/entry
for hash map overhead) and eliminates snapshot copies on read.

sortedInsert/sortedRemove create new slices on mutation, so readers
holding old slices are safe from concurrent changes. LookupResourceAttr
returns the live slice directly (zero-copy).

The layered reader uses two-pointer sorted merge for union operations.
The web API uses two-pointer sorted intersection for filter intersection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2026-03-20 17:56:16 +01:00
..
testhelpers tsdb: remove metric metadata persistence, refactor to generic kind framework 2026-03-20 17:56:16 +01:00
v1 tsdb/seriesmetadata: sorted-slice inverted index with copy-on-write 2026-03-20 17:56:16 +01:00