Skip to content

CI: Enabled(Level) check - #5

Open
foxyan-ru wants to merge 2 commits into
mainfrom
gate-check
Open

foxyan-ru wants to merge 2 commits into
mainfrom
gate-check

Conversation

@foxyan-ru

Copy link
Copy Markdown
Owner

Verification run for temporalio#219's Enabled(Level) change.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants