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)
| 105 | // Note: span IDs are not always unique within a trace (e.g. zipkin traces) SpanIDAndKindToToken could be more |
| 106 | // appropriate in some cases. |
| 107 | func 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 |
no outgoing calls