MCPcopy
hub / github.com/prometheus/prometheus / CompactHead

Method CompactHead

tsdb/db.go:1551–1563  ·  view source on GitHub ↗

CompactHead compacts the given RangeHead.

(head *RangeHead)

Source from the content-addressed store, hash-verified

1549
1550// CompactHead compacts the given RangeHead.
1551func (db *DB) CompactHead(head *RangeHead) error {
1552 db.cmtx.Lock()
1553 defer db.cmtx.Unlock()
1554
1555 if err := db.compactHead(head); err != nil {
1556 return fmt.Errorf("compact head: %w", err)
1557 }
1558
1559 if err := db.head.truncateWAL(head.BlockMaxTime()); err != nil {
1560 return fmt.Errorf("WAL truncation: %w", err)
1561 }
1562 return nil
1563}
1564
1565// CompactOOOHead compacts the OOO Head.
1566func (db *DB) CompactOOOHead(ctx context.Context) error {

Calls 4

compactHeadMethod · 0.95
LockMethod · 0.80
truncateWALMethod · 0.80
BlockMaxTimeMethod · 0.80