I want to get some information from apm SpanContext to log in my logs, but I only can get transcationId, traceId and spanId, how to get the parent span id?
The code come from apmlogrus
// TraceContext returns a logrus.Fields containing the trace
// context of the transaction and span contained in ctx, if any.
func TraceContext(ctx context.Context) logrus.Fields {
tx := apm.TransactionFromContext(ctx)
if tx == nil {
return nil
}
traceContext := tx.TraceContext()
fields := logrus.Fields{
FieldKeyTraceID: traceContext.Trace,
FieldKeyTransactionID: traceContext.Span,
}
if span := apm.SpanFromContext(ctx); span != nil {
fields[FieldKeySpanID] = span.TraceContext().Span
}
return fields
}