-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The new design passes an atomic pointer to the named logger's base handler, and a slice of transformer functions which can rebuild the final handler by replaying a sequence of WithGroup and WithAttrs calls. Each flume.handler now stores a copy of the base delegate's pointer, and a copy of the final delegate, run through the transformers. Each time it logs a record, it checks whether the base pointer has changed, and if so, re-builds and caches the final delegate. This design has many advantages, and one cost. The cost is that it does two atomic.Pointer.Load() calls per log, but in bench testing that is only adding about 1ns overhead (more than 10x faster than a mutex). The advantages are: - no references from parents to children, meaning no need to implement weakrefs - don't need to track groups and attrs the child handlers - fewer locks - changing a setting in the Controller is a bit faster...the new sink is propagated lazily to child handlers
- Loading branch information
Russ Egan
committed
Jan 27, 2025
1 parent
c9da279
commit 7fd88a8
Showing
7 changed files
with
123 additions
and
210 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
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
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
Oops, something went wrong.