mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-10-30 18:26:25 +00:00
22 lines
379 B
Go
22 lines
379 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/hex"
|
|
|
|
"go.opentelemetry.io/collector/pdata/pcommon"
|
|
)
|
|
|
|
func TraceIDToHexOrEmptyString(traceID pcommon.TraceID) string {
|
|
if !traceID.IsEmpty() {
|
|
return hex.EncodeToString(traceID[:])
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func SpanIDToHexOrEmptyString(spanID pcommon.SpanID) string {
|
|
if !spanID.IsEmpty() {
|
|
return hex.EncodeToString(spanID[:])
|
|
}
|
|
return ""
|
|
}
|