Skip to content

feat: Add otel logger#481

Merged
wangyb-A merged 2 commits into
mainfrom
otel_logging
Jun 18, 2026
Merged

feat: Add otel logger#481
wangyb-A merged 2 commits into
mainfrom
otel_logging

Conversation

@wangyb-A

@wangyb-A wangyb-A commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available: close #385

Description of changes:

Testing

OTel log enrichment — sample output

Logs from the OtelLoggerExample-Python durable function. Each application log emitted through the root logger is automatically stamped with otel_trace_id, otel_span_id, and otel_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.

@wangyb-A wangyb-A requested a review from zhongkechen June 18, 2026 00:08
@wangyb-A wangyb-A marked this pull request as ready for review June 18, 2026 00:08
SilanHe
SilanHe previously approved these changes Jun 18, 2026

@zhongkechen zhongkechen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thank you

@wangyb-A wangyb-A merged commit 277bd28 into main Jun 18, 2026
123 of 129 checks passed
@wangyb-A wangyb-A deleted the otel_logging branch June 18, 2026 19:40
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.

[Feature]: logging interface for plugin

3 participants