TraceIDToHexString converts a trace ID to its string representation and removes any leading zeros.
(byteID []byte)
| 30 | |
| 31 | // TraceIDToHexString converts a trace ID to its string representation and removes any leading zeros. |
| 32 | func 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 |