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

Function parseName

tempodb/encoding/vparquet4/wal_block.go:942–968  ·  view source on GitHub ↗

<blockID>+<tenantID>+vParquet

(filename string)

Source from the content-addressed store, hash-verified

940
941// <blockID>+<tenantID>+vParquet
942func parseName(filename string) (uuid.UUID, string, string, error) {
943 splits := strings.Split(filename, "+")
944
945 if len(splits) != 3 {
946 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. unexpected number of segments", filename)
947 }
948
949 // first segment is blockID
950 id, err := uuid.Parse(splits[0])
951 if err != nil {
952 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. error parsing uuid: %w", filename, err)
953 }
954
955 // second segment is tenant
956 tenant := splits[1]
957 if len(tenant) == 0 {
958 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. 0 length tenant", filename)
959 }
960
961 // third segment is version
962 version := splits[2]
963 if version != VersionString {
964 return uuid.UUID{}, "", "", fmt.Errorf("unable to parse %s. unexpected version %s", filename, version)
965 }
966
967 return id, tenant, version, nil
968}
969
970// rowIterator is used to iterate a parquet file and implement iterIterator
971// 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