coroot-node-agent
coroot-node-agent copied to clipboard
parent-child relationship of traceIds
Excuse me, how is the parent-child relationship of traceIds generated in the node-agent? I only found the following code. Is the parentTraceId an empty string here? Thank you very much.
func (t *Trace) createSpan(name string, duration time.Duration, error bool, attrs ...attribute.KeyValue) { if t.tracer.otel == nil { return } end := time.Now()
if !shouldSample() {
return
}
start := end.Add(-duration)
_, span := t.tracer.otel.Start(nil, name, trace.WithTimestamp(start), trace.WithSpanKind(trace.SpanKindClient)) //context is nil
span.SetAttributes(attrs...)
span.SetAttributes(t.commonAttrs...)
if error {
span.SetStatus(codes.Error, "")
}
span.End(trace.WithTimestamp(end))