coroot-node-agent icon indicating copy to clipboard operation
coroot-node-agent copied to clipboard

parent-child relationship of traceIds

Open tyyangsf opened this issue 4 months ago • 0 comments

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))

}

tyyangsf avatar Sep 04 '25 08:09 tyyangsf