MCPcopy
hub / github.com/prometheus/prometheus / createBlockFromHead

Function createBlockFromHead

tsdb/block_test.go:628–640  ·  view source on GitHub ↗
(tb testing.TB, dir string, head *Head)

Source from the content-addressed store, hash-verified

626}
627
628func createBlockFromHead(tb testing.TB, dir string, head *Head) string {
629 compactor, err := NewLeveledCompactor(context.Background(), nil, promslog.NewNopLogger(), []int64{1000000}, nil, nil)
630 require.NoError(tb, err)
631
632 require.NoError(tb, os.MkdirAll(dir, 0o777))
633
634 // Add +1 millisecond to block maxt because block intervals are half-open: [b.MinTime, b.MaxTime).
635 // Because of this block intervals are always +1 than the total samples it includes.
636 ulids, err := compactor.Write(dir, head, head.MinTime(), head.MaxTime()+1, nil)
637 require.NoError(tb, err)
638 require.Len(tb, ulids, 1)
639 return filepath.Join(dir, ulids[0].String())
640}
641
642func createBlockFromOOOHead(tb testing.TB, dir string, head *OOOCompactionHead) string {
643 compactor, err := NewLeveledCompactor(context.Background(), nil, promslog.NewNopLogger(), []int64{1000000}, nil, nil)

Callers 3

BenchmarkQuerierFunction · 0.85
BenchmarkQuerierSelectFunction · 0.85

Calls 6

WriteMethod · 0.95
NewLeveledCompactorFunction · 0.85
LenMethod · 0.65
StringMethod · 0.65
MinTimeMethod · 0.45
MaxTimeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…