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

Function parseName

tempodb/encoding/vparquet5/wal_block.go:991–1017  ·  view source on GitHub ↗

<blockID>+<tenantID>+vParquet

(filename string)

Source from the content-addressed store, hash-verified

989
990// <blockID>+<tenantID>+vParquet
991func parseName(filename string) (uuid.UUID, string, string, error) {
992 splits := strings.Split(filename, "+")
993
994 if len(splits) != 3 {
995 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. unexpected number of segments", filename)
996 }
997
998 // first segment is blockID
999 id, err := uuid.Parse(splits[0])
1000 if err != nil {
1001 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. error parsing uuid: %w", filename, err)
1002 }
1003
1004 // second segment is tenant
1005 tenant := splits[1]
1006 if len(tenant) == 0 {
1007 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. 0 length tenant", filename)
1008 }
1009
1010 // third segment is version
1011 version := splits[2]
1012 if version != VersionString {
1013 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. unexpected version %s", filename, version)
1014 }
1015
1016 return id, tenant, version, nil
1017}
1018
1019// rowIterator is used to iterate a parquet file and implement iterIterator
1020// traces are iterated according to the given row numbers, because there is

Callers 3

openWALBlockFunction · 0.70
ownsWALBlockFunction · 0.70
TestParseFilenameFunction · 0.70

Calls 1

ParseMethod · 0.65

Tested by 1

TestParseFilenameFunction · 0.56