in pkg/ottl/contexts/internal/ctxspan/span.go [23:116]
func PathGetSetter[K Context](path ottl.Path[K]) (ottl.GetSetter[K], error) {
if path == nil {
return nil, ctxerror.New("nil", "nil", Name, DocRef)
}
switch path.Name() {
case "trace_id":
nextPath := path.Next()
if nextPath != nil {
if nextPath.Name() == "string" {
return accessStringTraceID[K](), nil
}
return nil, ctxerror.New(nextPath.Name(), nextPath.String(), Name, DocRef)
}
return accessTraceID[K](), nil
case "span_id":
nextPath := path.Next()
if nextPath != nil {
if nextPath.Name() == "string" {
return accessStringSpanID[K](), nil
}
return nil, ctxerror.New(nextPath.Name(), nextPath.String(), Name, DocRef)
}
return accessSpanID[K](), nil
case "trace_state":
mapKey := path.Keys()
if mapKey == nil {
return accessTraceState[K](), nil
}
return accessTraceStateKey[K](mapKey)
case "parent_span_id":
nextPath := path.Next()
if nextPath != nil {
if nextPath.Name() == "string" {
return accessStringParentSpanID[K](), nil
}
return nil, ctxerror.New(nextPath.Name(), nextPath.String(), Name, DocRef)
}
return accessParentSpanID[K](), nil
case "name":
return accessSpanName[K](), nil
case "kind":
nextPath := path.Next()
if nextPath != nil {
switch nextPath.Name() {
case "string":
return accessStringKind[K](), nil
case "deprecated_string":
return accessDeprecatedStringKind[K](), nil
default:
return nil, ctxerror.New(nextPath.Name(), nextPath.String(), Name, DocRef)
}
}
return accessKind[K](), nil
case "start_time_unix_nano":
return accessStartTimeUnixNano[K](), nil
case "end_time_unix_nano":
return accessEndTimeUnixNano[K](), nil
case "start_time":
return accessStartTime[K](), nil
case "end_time":
return accessEndTime[K](), nil
case "attributes":
mapKeys := path.Keys()
if mapKeys == nil {
return accessAttributes[K](), nil
}
return accessAttributesKey[K](mapKeys), nil
case "dropped_attributes_count":
return accessSpanDroppedAttributesCount[K](), nil
case "events":
return accessEvents[K](), nil
case "dropped_events_count":
return accessDroppedEventsCount[K](), nil
case "links":
return accessLinks[K](), nil
case "dropped_links_count":
return accessDroppedLinksCount[K](), nil
case "status":
nextPath := path.Next()
if nextPath != nil {
switch nextPath.Name() {
case "code":
return accessStatusCode[K](), nil
case "message":
return accessStatusMessage[K](), nil
default:
return nil, ctxerror.New(nextPath.Name(), nextPath.String(), Name, DocRef)
}
}
return accessStatus[K](), nil
default:
return nil, ctxerror.New(path.Name(), path.String(), Name, DocRef)
}
}