Skip to content

parent-child relationship of traceIds #241

@tyyangsf

Description

@tyyangsf

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

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions