Repository navigation
perf(logger): reduce encoding allocations and filtered trace work - #249
Merged
Merged
Conversation
Contributor
Author
|
Author self-review of ab093bc completed; no additional defect identified.
|
8 tasks done
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.
Issue
Refs #248
Summary
Logger previously copied and reflectively traversed ordinary field maps, marshaled every root key and value separately, rebuilt duplicate ordering state, and looked up buffer trace data even when buffering was disabled. Use one JSON v2 encoder over an owned normalized root, direct map/scalar traversal, and conditional trace lookup. Keep full-record buffering before the single sink write and append its newline without an extra copy.
Preserve ordering and omissions, original formatter/replacer inputs, custom marshaler errors, dynamic trace precedence, invocation closure, buffering and the main-only stack Preview. Add warm-invocation/direct-JSON controls and targeted regression coverage; record the verified local milestone and measured scope.
Testing
integration/loggereventLambda SDK fixture passed withCGO_ENABLED=0.GOWORK=off, including one independent public Logger consumer.git diff --checkpassed. Hosted CI run 38759475302 passed documentation and all three affected packaged modules (Logger, examples, integration), including one independent consumer. The change selector skipped the separate runtime-simulation job; no new Docker runtime acceptance is claimed, and local Docker was not retried after its earlier startup failure.Risks and compatibility
No public API, dependency, unsafe/CGO, version tag or Go release changes. Source contains the existing main-only stack Preview; v1.2.0 remains unchanged. Only owned normalized root maps and encoded records are consumed; caller and hook inputs remain intact. Sink writers must follow io.Writer's existing ownership contract.
Local counting-writer measurements identify overhead, not CloudWatch/stdout latency or predicted AWS Lambda improvement. No AWS performance tests or race detector were run. Broader wrapper/cold-start and other-module optimizations remain outside this scoped fix.
Release notes
Checklist