Skip to content

[Tracing Framework] Fix parent span setting in case multiple tasks are created from a single thread #8428

@Gaganjuneja

Description

@Gaganjuneja

Is your feature request related to a problem? Please describe.
Addresses the issue with code change #7543
For an instance where multiple tasks are being submitted from a loop the parent span is getting wrongly set.

Example :-
Parent - A

for(int i=0; i<array["B", "C", "D", "E"].length; i++){
       performPhaseOnShard(array[i]);
}

performPhaseOnShard executes the phase on the node where the shard is located, it could be locally or external data node. If we start a span from inside the performPhaseOnShard method, it creates the shard and sets this newly created span as a parent for the future spans. E.x here

  1. performPhaseOnShard for shard B will have parent span as A.
  2. performPhaseOnShard for shard C will have parent span as B. Which is wrong and should ideally be A
  3. Similarly, performPhaseOnShard for shard C will have a parent span as C.

Describe the solution you'd like
Ideally we need to reset the context in this scenario, so Tracer should provide a new Releasable TracerContext which can be reset to the original one of releasing the current context.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions