Omit invocationId from error/critical logs to allow aggregation - #87
Closed
wparad wants to merge 2 commits into
Closed
Omit invocationId from error/critical logs to allow aggregation#87wparad wants to merge 2 commits into
wparad wants to merge 2 commits into
Conversation
invocationId is unique per Lambda invocation, so including it on error and critical log entries defeated log-aggregation/error-tracking tools that group errors by identical fields. info/warn/track logs are unaffected and still carry it for correlation.
invocationId was never embedded in the log message/title text, so omitting it from error/critical entries wasn't necessary to keep aggregation working — it's a separate structured field. Revert to always including it for request correlation.
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.
Summary
RequestLoggerno longer includesinvocationId(the per-request composite request ID) onerror/criticallog entries, since a value that's unique per invocation prevents log-aggregation/error-tracking tools from grouping identical errors together.info/warn/trackentries are unaffected and still carryinvocationIdfor request correlation.invocationIdin thecontextobject leaking through on error/critical entries (context is spread before the guaranteed fields are re-applied).Test plan
npx tsc --noEmit -p .npx eslint src/logger.tsnpx vitest run tests/logger.property.spec.ts— updated existing structural-invariant test for the new per-level behavior and added a regression test for the context-leak guardnpm test(lint + typecheck + full vitest suite) — all 2845 tests pass🤖 Generated with Claude Code
Generated by Claude Code