feat: Add otel logger#481
Merged
Merged
Conversation
SilanHe
reviewed
Jun 18, 2026
SilanHe
previously approved these changes
Jun 18, 2026
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 #, if available: close #385
Description of changes:
Testing
OTel log enrichment — sample output
Logs from the
OtelLoggerExample-Pythondurable function. Each application log emitted through the root logger is automatically stamped withotel_trace_id,otel_span_id, andotel_trace_sampled. The span id tracks the active operation (invocation → step → child context → child step), all sharing one trace id.{"timestamp": "2026-06-18T00:05:00Z", "level": "INFO", "message": "Workflow started", "logger": "root", "requestId": "6d06f4c7-eefa-45c4-9253-05d1c79d2789", "executionArn": "arn:aws:lambda:us-west-2:590183769840:function:OtelLoggerExample-Python:$LATEST/durable-execution/ca57abc9-f202-41c5-80b0-ca3f1d162763/f3d4baae-014a-340f-99ad-fef654f5369d", "otel_trace_id": "6a3336274de546f9416117dc644fe6c8", "otel_span_id": "fe45c9e995fdcc3e", "otel_trace_sampled": true} {"timestamp": "2026-06-18T00:05:00Z", "level": "INFO", "message": "Greeting inside step", "logger": "root", "requestId": "6d06f4c7-eefa-45c4-9253-05d1c79d2789", "executionArn": "arn:aws:lambda:us-west-2:590183769840:function:OtelLoggerExample-Python:$LATEST/durable-execution/ca57abc9-f202-41c5-80b0-ca3f1d162763/f3d4baae-014a-340f-99ad-fef654f5369d", "operationName": "top-greet", "attempt": 1, "operationId": "1ced8f5be2db23a6513eba4d819c73806424748a7bc6fa0d792cc1c7d1775a97", "greeting_name": "world", "otel_trace_id": "6a3336274de546f9416117dc644fe6c8", "otel_span_id": "796a9b22593b6959", "otel_trace_sampled": true} {"timestamp": "2026-06-18T00:05:00Z", "level": "INFO", "message": "Entering child context", "logger": "root", "requestId": "6d06f4c7-eefa-45c4-9253-05d1c79d2789", "executionArn": "arn:aws:lambda:us-west-2:590183769840:function:OtelLoggerExample-Python:$LATEST/durable-execution/ca57abc9-f202-41c5-80b0-ca3f1d162763/f3d4baae-014a-340f-99ad-fef654f5369d", "parentId": "c5faca15ac2f93578b39ef4b6bbb871bdedce4ddd584fd31f0bb66fade3947e6", "otel_trace_id": "6a3336274de546f9416117dc644fe6c8", "otel_span_id": "be02ea8c17bd3715", "otel_trace_sampled": true} {"timestamp": "2026-06-18T00:05:00Z", "level": "INFO", "message": "Greeting inside step", "logger": "root", "requestId": "6d06f4c7-eefa-45c4-9253-05d1c79d2789", "executionArn": "arn:aws:lambda:us-west-2:590183769840:function:OtelLoggerExample-Python:$LATEST/durable-execution/ca57abc9-f202-41c5-80b0-ca3f1d162763/f3d4baae-014a-340f-99ad-fef654f5369d", "parentId": "c5faca15ac2f93578b39ef4b6bbb871bdedce4ddd584fd31f0bb66fade3947e6", "operationName": "child-greet", "attempt": 1, "operationId": "9b9a566e6a3acb025bf1e7f9316f877f4def1a4320ddf2c8674e0fa6ceea6d64", "greeting_name": "nested", "otel_trace_id": "6a3336274de546f9416117dc644fe6c8", "otel_span_id": "67fdcf54688f3644", "otel_trace_sampled": true} {"timestamp": "2026-06-18T00:05:00Z", "level": "INFO", "message": "Leaving child context", "logger": "root", "requestId": "6d06f4c7-eefa-45c4-9253-05d1c79d2789", "executionArn": "arn:aws:lambda:us-west-2:590183769840:function:OtelLoggerExample-Python:$LATEST/durable-execution/ca57abc9-f202-41c5-80b0-ca3f1d162763/f3d4baae-014a-340f-99ad-fef654f5369d", "parentId": "c5faca15ac2f93578b39ef4b6bbb871bdedce4ddd584fd31f0bb66fade3947e6", "result": "hello nested", "otel_trace_id": "6a3336274de546f9416117dc644fe6c8", "otel_span_id": "be02ea8c17bd3715", "otel_trace_sampled": true} {"timestamp": "2026-06-18T00:05:01Z", "level": "INFO", "message": "Workflow completed", "logger": "root", "requestId": "6d06f4c7-eefa-45c4-9253-05d1c79d2789", "executionArn": "arn:aws:lambda:us-west-2:590183769840:function:OtelLoggerExample-Python:$LATEST/durable-execution/ca57abc9-f202-41c5-80b0-ca3f1d162763/f3d4baae-014a-340f-99ad-fef654f5369d", "top": "hello world", "nested": "hello nested", "otel_trace_id": "6a3336274de546f9416117dc644fe6c8", "otel_span_id": "fe45c9e995fdcc3e", "otel_trace_sampled": true}By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.