Repository navigation
Conversation
Building the tags for a Debug entry allocates even when the configured level discards it, and the router builds that entry on every request. Profiling a request-shaped benchmark run attributed 25.89% of the router binary's total allocations to tag.String, and Director_Resolve measured 5 allocations per Resolve, most of them the four tags handed to Debug that an operator at the default level never sees. The routing decision itself is already counted in decisions_total. Logger gains DebugEnabled, which reports whether Debug entries are recorded, so hot-path callers can skip constructing Debug-only tags. ZeroLogger answers from its configured level, NoopLogger answers false, and TestLogger answers true since it records every level. The director gates its routing entry on it. Measured against the benchmarks from the previous commit, 10 rounds per side (benchstat, shared 2-vCPU host; allocs/op and B/op are deterministic and primary): Director_Resolve drops from 5 to 0 allocations and from ~501ns to ~83ns (-83%, p=0.000); the whole-path benchmark drops from 400 to 395 allocations (p=0.000); protoutil benchmarks and the no-proxy baseline are unchanged (all samples equal). Behavior at debug level is unchanged.
Review on temporalio#219 asked for a single Enabled(lvl Level) method so the next gate does not need another breaking interface change. The package-level Enabled over Default keeps the mirror with the other log functions, and an unrecognized level answers true so a bad value never hides logs.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verification run for temporalio#219's Enabled(Level) change.