Skip to content

Omit invocationId from error/critical logs to allow aggregation - #87

Closed
wparad wants to merge 2 commits into
mainfrom
claude/error-log-request-id-fzc1tv
Closed

Omit invocationId from error/critical logs to allow aggregation#87
wparad wants to merge 2 commits into
mainfrom
claude/error-log-request-id-fzc1tv

Conversation

@wparad

@wparad wparad commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • RequestLogger no longer includes invocationId (the per-request composite request ID) on error/critical log entries, since a value that's unique per invocation prevents log-aggregation/error-tracking tools from grouping identical errors together.
  • info/warn/track entries are unaffected and still carry invocationId for request correlation.
  • Guarded against a caller-supplied invocationId in the context object 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.ts
  • npx 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 guard
  • npm test (lint + typecheck + full vitest suite) — all 2845 tests pass

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits August 25, 2026 19:16
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.
@wparad wparad closed this Aug 25, 2026
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