in store/kustoSpan.go [162:193]
func transformReferencesToLinks(kustoSpan *kustoSpan, logger hclog.Logger) ([]dbmodel.Reference, error) {
// There are 2 parts in the links. The first one is the CHILD_OF hierarchy and the second one is the FOLLOWS_FROM hierarchy
// Ref : https://opentelemetry.io/docs/specs/otel/trace/sdk_exporters/jaeger/#links
// Note that we can convert SpanLinkAttributes to logs too. But this is not added at the moment
var childOfRefs []dbmodel.Reference
referenceValue := kustoSpan.References.Value
if len(referenceValue) > 0 {
err := json.Unmarshal(referenceValue, &childOfRefs)
if err != nil {
logger.Error(fmt.Sprintf("Error in Unmarshal CO refs %s. TraceId: %s SpanId: %s. References: %s",
kustoSpan.References.String(), kustoSpan.TraceID, kustoSpan.SpanID, kustoSpan.References.Value), err)
return nil, err
}
}
var followsFromRefs []dbmodel.Reference
for _, ref := range kustoSpan.Links {
if ref.TraceID == "" || ref.SpanID == "" { // Skip the empty references
logger.Warn(fmt.Sprintf("Empty link TraceID or SpanID for RefType %s . TraceId: %s SpanId: %s",
ref.RefType, kustoSpan.TraceID, kustoSpan.SpanID))
} else {
followsFromRefs = append(followsFromRefs, dbmodel.Reference{
RefType: dbmodel.FollowsFrom,
TraceID: ref.TraceID,
SpanID: ref.SpanID,
})
}
}
// Combine the childOfRefs and followsFromRefs
spanRefs := append(childOfRefs, followsFromRefs...)
return spanRefs, nil
}