Skip to content

trace_ID confusion during concurrency #1900

@lihaopeng1

Description

@lihaopeng1

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 0
what should I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions