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

Function writeAttributeIndex

cmd/tempo-cli/cmd-gen-attrindex.go:565–595  ·  view source on GitHub ↗
(in string, index []T)

Source from the content-addressed store, hash-verified

563}
564
565func writeAttributeIndex[T any](in string, index []T) error {
566 stat, err := os.Stat(filepath.Join(in, "data.parquet"))
567 if err != nil {
568 return err
569 }
570
571 out, err := os.OpenFile(filepath.Join(in, "index.parquet"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, stat.Mode())
572 if err != nil {
573 return err
574 }
575 defer out.Close()
576
577 writer := parquet.NewGenericWriter[T](out)
578 defer writer.Close()
579
580 writeCount := 0
581 for writeCount < len(index) {
582 n, err := writer.Write(index[writeCount:])
583 if err != nil {
584 return err
585 }
586 writeCount += n
587 }
588
589 err = writer.Flush()
590 if err != nil {
591 return err
592 }
593
594 return nil
595}
596
597type fileStats struct {
598 Traces int

Callers 1

RunMethod · 0.85

Calls 4

JoinMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
FlushMethod · 0.65

Tested by

no test coverage detected