trace_ID confusion during concurrency #1928
Replies: 3 comments
-
"Why do I have the same trace_ID when I am concurrent" ... please clarify which trace_id() value is seen here, always 0 or always something that looks populated (and identical for all threads) ? Please clarify how To start a root span, do not set a parent. To start a child span, set the parent to the parent span. Even for a root span, the trace_id should never be 0, it should be a random number for the new trace, and yes, separate traces for separate threads should have different non 0 trace_id(), generated by the call to StartSpan(). It would help to see actual values with an example, to investigate further. |
Beta Was this translation helpful? Give feedback.
-
What should I do if I want different requests in the same thread space to be buried as root span instead of active_span? |
Beta Was this translation helpful? Give feedback.
-
Moving this to discussion for now. We can move this back to issue list if this is valid bug. @lihaopeng1 Your explanation is not very clear to me. Can you please try explaining your scenario once again. |
Beta Was this translation helpful? Give feedback.
-
namespace trace = opentelemetry::trace;
namespace nostd = opentelemetry::nostd;
nostd::shared_ptr<trace::Tracer> UJaeger::get_tracer()
{
auto provider = trace::Provider::GetTracerProvider();
auto tracer = provider->GetTracer(mod_name.c_str());
return tracer;
}
span = get_tracer()->StartSpan
Why do I have the same trace_ID when I am concurrent, I want each thread to have an independent trace_ID,
Initial start() I hope
get_tracer()->GetCurrentSpan()->GetContext().trace_id();
to be 0what should I do?
Beta Was this translation helpful? Give feedback.
All reactions