MCPcopy
hub / github.com/grafana/tempo / file

Method file

tempodb/encoding/vparquet3/wal_block.go:215–245  ·  view source on GitHub ↗

file() opens the parquet file and returns it. previously this method cached the file on first open but the memory cost of this was quite high. so instead we open it fresh every time. This also allows it to take the context for the caller.

(ctx context.Context)

Source from the content-addressed store, hash-verified

213// but the memory cost of this was quite high. so instead we open it fresh every time. This
214// also allows it to take the context for the caller.
215func (w *walBlockFlush) file(ctx context.Context) (*pageFile, error) {
216 if err := ctx.Err(); err != nil {
217 return nil, err
218 }
219
220 file, err := os.OpenFile(w.path, os.O_RDONLY, 0o600)
221 if err != nil {
222 return nil, fmt.Errorf("error opening file: %w", err)
223 }
224 info, err := file.Stat()
225 if err != nil {
226 return nil, fmt.Errorf("error getting file info: %w", err)
227 }
228 size := info.Size()
229
230 wr := newWalReaderAt(ctx, file)
231 o := []parquet.FileOption{
232 parquet.SkipBloomFilters(true),
233 parquet.SkipPageIndex(true),
234 parquet.FileSchema(parquetSchema),
235 }
236
237 pf, err := parquet.OpenFile(wr, size, o...)
238 if err != nil {
239 return nil, fmt.Errorf("error opening parquet file: %w", err)
240 }
241
242 f := &pageFile{parquetFile: pf, osFile: file, r: wr}
243
244 return f, nil
245}
246
247func (w *walBlockFlush) rowIterator(ctx context.Context) (*rowIterator, error) {
248 file, err := w.file(ctx)

Callers 9

rowIteratorMethod · 0.95
openWALBlockFunction · 0.45
FindTraceByIDMethod · 0.45
SearchMethod · 0.45
SearchTagsMethod · 0.45
SearchTagValuesV2Method · 0.45
FetchMethod · 0.45
FetchTagValuesMethod · 0.45
FetchTagNamesMethod · 0.45

Calls 2

newWalReaderAtFunction · 0.70
SizeMethod · 0.65

Tested by

no test coverage detected