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

Function TraceIDToHexString

pkg/util/traceid.go:32–41  ·  view source on GitHub ↗

TraceIDToHexString converts a trace ID to its string representation and removes any leading zeros.

(byteID []byte)

Source from the content-addressed store, hash-verified

30
31// TraceIDToHexString converts a trace ID to its string representation and removes any leading zeros.
32func TraceIDToHexString(byteID []byte) string {
33 dst := make([]byte, hex.EncodedLen(len(byteID)))
34 hex.Encode(dst, byteID)
35 // fast conversion to string
36 p := unsafe.SliceData(dst)
37 id := unsafe.String(p, len(dst))
38 // remove leading zeros
39 id = strings.TrimLeft(id, "0")
40 return id
41}
42
43// SpanIDToHexString converts a span ID to its string representation and WITHOUT removing any leading zeros.
44// If the id is < 16, left pad with 0s

Callers 15

makeExpectedTraceFunction · 0.92
testSearchFunction · 0.92
BenchmarkSearchFunction · 0.92
KeepGroupMethod · 0.92
KeepGroupMethod · 0.92
TestBackendBlockSearchFunction · 0.92
findTraceByIDFunction · 0.92
rawToResultsFunction · 0.92

Calls 2

EncodeMethod · 0.65
StringMethod · 0.45