Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to create a root span (span with no parent) when another span is active. #2413

Closed
lalitb opened this issue Nov 21, 2023 · 2 comments · Fixed by #2427
Closed

Ability to create a root span (span with no parent) when another span is active. #2413

lalitb opened this issue Nov 21, 2023 · 2 comments · Fixed by #2427
Assignees
Labels
triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@lalitb
Copy link
Member

lalitb commented Nov 21, 2023

As discussed here - #2410, creating the issue to evaluate/discuss support for creating a root span when another span is active.

{
    auto root1 = tracer->StartSpan("span 1");
    auto root2 = trace->StartSpan("span 2");

    auto token = tracer->WithActiveSpan(root1); // root 1 active
    auto child_root1 = tracer->StartSpan("child of root1"); // child of root1

    trace_api::StartSpanOptions options;
    options.parent = root2;
    auto child_root2 = tracer->StartSpan("child of root2", options); // child of root2
  
    // trying to create a span with no parent now.
    options.parent = SpanContext(false, false);
    auto root3 = tracer->StartSpan("root3", options); // root3 is child of root1 which is not desired
   
    opentelemetry::context::Context c1;
    options.parent = c1;
    root3 = tracer->StartSpan("root3", options); // root3 is child of root1 which is not desired

    trace_api::StartSpanOptions options2;
    root3 = tracer->StartSpan("root3", options2); // root3 is child of root1 which is not desired

}

When one can create a span that is a child to a non-active span, should it also be possible to create a span with no parent?

@lalitb lalitb added the bug Something isn't working label Nov 21, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 21, 2023
@lalitb lalitb removed the bug Something isn't working label Nov 21, 2023
@alevenberg
Copy link

alevenberg commented Nov 21, 2023

cc @dbolduc

@ThomsonTan ThomsonTan added abi:version_2 Fix is available WITH_ABI_VERSION_2 triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Nov 29, 2023
@ThomsonTan
Copy link
Contributor

@lalitb will propose 2 options, 1 breaks ABI and the other doesn't

@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 29, 2023
@esigo esigo removed the abi:version_2 Fix is available WITH_ABI_VERSION_2 label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants