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

RUMM-976 GH Issue #363 #365

Merged
merged 1 commit into from
Jan 12, 2021
Merged

Conversation

buranmert
Copy link
Contributor

@buranmert buranmert commented Jan 12, 2021

Fixes #363

What and why?

Baggage items were not propagated to span's children
A great explanation can be found in #363

How?

Now BaggageItems.get(key) searches in parent.baggageItems recursively

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

@buranmert buranmert added the bug Something isn't working label Jan 12, 2021
@buranmert buranmert added this to the next-version milestone Jan 12, 2021
@buranmert buranmert requested a review from a team as a code owner January 12, 2021 10:56
@buranmert buranmert self-assigned this Jan 12, 2021
@buranmert buranmert force-pushed the buranmert/RUMM-976-parent-baggageItems-fix branch 3 times, most recently from 189c9fb to 89c2476 Compare January 12, 2021 11:13
@@ -49,7 +49,7 @@ internal class BaggageItems {
}

func get(key: String) -> String? {
queue.sync { self.unsafeItems[key] }
queue.sync { self.unsafeItems[key] } ?? parent?.get(key: key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This read isn't atomic and blocks the thread several times:

queue.sync { ... } ?? queue.sync { ... } ?? queue.sync { ... } ?? ... N

depending on how many N parent contexts there are in the hierarchy.


We can make it atomic and ensure there's only one thread sync (queue.sync { ... }) executed if we just do:

queue.sync { self.unsafeAll[key] }

As unsafeAll doc comment says, it:

Returns all baggage items for the span, including its parent items.

BaggageItems.get(key) searches in parent.baggageItems too
@buranmert buranmert force-pushed the buranmert/RUMM-976-parent-baggageItems-fix branch from 89c2476 to 034ed84 Compare January 12, 2021 14:00
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@buranmert buranmert merged commit a07293b into master Jan 12, 2021
@buranmert buranmert deleted the buranmert/RUMM-976-parent-baggageItems-fix branch January 12, 2021 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Baggage items not propagated to span's descendants
2 participants