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

Function SpanIDToUint64

pkg/util/traceid.go:107–114  ·  view source on GitHub ↗

SpanIDToUint64 converts a span ID into an uint64 representation. This is useful when using a span ID as key in a map. If the ID is longer than 8 bytes, the bytes at larger positions are discarded. The function does not make any guarantees about the endianess or ordering of converted IDs. Note: span

(id []byte)

Source from the content-addressed store, hash-verified

105// Note: span IDs are not always unique within a trace (e.g. zipkin traces) SpanIDAndKindToToken could be more
106// appropriate in some cases.
107func SpanIDToUint64(id []byte) uint64 {
108 if len(id) < 8 {
109 var idArray [8]byte
110 copy(idArray[:], id)
111 return *(*uint64)(unsafe.Pointer(&idArray[0]))
112 }
113 return *(*uint64)(unsafe.Pointer(&id[0]))
114}
115
116// EqualHexStringTraceIDs compares two trace ID strings and compares the
117// resulting bytes after padding. Returns true unless there is a reason not

Callers 9

findParentNodeInMapFunction · 0.92
findParentNodeInMapFunction · 0.92
findParentNodeInMapFunction · 0.92
TestSpanIDToUint64Function · 0.85
TestSpanIDAndKindToTokenFunction · 0.85
SpanIDAndKindToTokenFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestSpanIDToUint64Function · 0.68
TestSpanIDAndKindToTokenFunction · 0.68