-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ddtrace/tracer: optimize baggage item handling. (#611)
When creating a span, ForEachBaggageItem is called, which acquires a mutex to check for and copy baggage items. Often no baggage is present, and the expensive mutex Lock() and Unlock() are a waste. This commit adds an atomic int32 which is set whenever the first baggage item is set, and checked in ForEachBaggageItem to see if any baggage is present before doing the more expensive mutex Lock(). It also checks the int before locking in the baggageItem() function.
- Loading branch information
Showing
2 changed files
with
39 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters