Skip to content

fix: align log metadata with other SDKs#465

Open
zhongkechen wants to merge 1 commit into
mainfrom
logger
Open

fix: align log metadata with other SDKs#465
zhongkechen wants to merge 1 commit into
mainfrom
logger

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Issue Link, if available

Fixes #440

Description

Align durable execution log metadata with the JavaScript and Python SDKs by moving MDC context management into DurableLogger and updating the emitted key names. This also separates logger scope cleanup from durable context objects so context lifecycles are clearer and less error-prone.

  • Refactor DurableLogger to manage MDC state through attach/detach helpers instead of storing a logger per durable context.
  • Add SafeCloseable so logger context scopes can be used with try-with-resources without checked-exception noise.
  • Align MDC field names with the other SDKs by default:
    • executionArn instead of durableExecutionArn
    • root/child durable contexts emit operationId / operationName
    • step contexts continue to emit operationId, operationName, and attempt
  • Add LoggerConfig.oldKeyNames to preserve backward compatibility for consumers that still expect the previous MDC field names.
  • Remove AutoCloseable / close() responsibilities from durable context types and make logger scoping explicit at user-code execution boundaries.
  • Update DurableExecutor, StepOperation, ChildContextOperation, and WaitForConditionOperation to attach/detach logger scope around user code.
  • Update ExecutionManager and ParallelDurableFuture to use SafeCloseable instead of AutoCloseable.

Demo/Screenshots

image

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

Testing

Added a new case testLoggingExample to run logginer-example.

Expanded DurableLoggerTest coverage for:

  • replay log suppression behavior
  • MDC population for durable and step contexts
  • MDC cleanup on detach
  • replay-to-execution transition behavior
  • all supported log levels
  • null request ID handling
  • old vs new MDC key expectations

Unit Tests

Yes

Integration Tests

No

Examples

N/A

@zhongkechen zhongkechen requested a review from a team June 17, 2026 22:58
@zhongkechen zhongkechen added the BREAKING Something that is going to break existing users label Jun 17, 2026
@zhongkechen zhongkechen force-pushed the logger branch 7 times, most recently from e4afcde to b286f5b Compare June 18, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING Something that is going to break existing users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix]: Implement Option 3 in the field name discussion

1 participant