Repository navigation
Description
What would you like?
When the Java OTel plugin is active, emit the OpenTelemetry log fields severityText and severityNumber on durable application logs, alongside the existing logging framework's level and execution/trace metadata.
This is the Java counterpart of aws/aws-durable-execution-sdk-js#1228. OTel-aware consumers, including CloudWatch Logs Analyze logs as described in that issue, need standard severity fields to recognize, filter, and group severity consistently.
Use the OTel SeverityNumber mapping:
| Java log level | severityText | severityNumber |
|---|---|---|
| TRACE | TRACE | 1 |
| DEBUG | DEBUG | 5 |
| INFO | INFO | 9 |
| WARN | WARN | 13 |
| ERROR | ERROR | 17 |
Current Behavior
On main at 67c6ef605fa000300e139e03205dff3d71038094:
DurableLoggerdelegates TRACE/DEBUG/INFO/WARN/ERROR to SLF4J and handles replay suppression.MdcSpanEnricherinjectstraceId,spanId, andotelTraceSampled, but no severity fields.
The SDK's OTel integration does not supply standard log severity fields; additional application logging instrumentation may supply them independently. This finding is based on source inspection.
Possible Implementation
Add per-log-event severity enrichment through the Java logging integration used by the OTel plugin. Cover both Execution and Invocation views and document the supported structured logging configuration.
Java needs a logging-framework-aware implementation: a lifecycle MDC hook does not know the level of each log call, MDC values are strings, and layouts may nest MDC fields. Ensure the final structured record contains top-level severityText and a numeric severityNumber, rather than only a nested string-valued MDC entry.
Acceptance criteria:
- Emit the mappings above through the real
context.getLogger()and step logger paths when the OTel plugin is active. - Preserve existing level fields, messages, execution metadata, trace correlation, and logging thresholds.
- Keep the default logging behavior unchanged when the OTel plugin is absent.
- Verify the final serialized log output and numeric field type, including configured TRACE/DEBUG logging.
- Cover initial invocation and durable wait/resume; preserve replay suppression and avoid severity state leaking between log calls or concurrent invocations.
Is this a breaking change?
No. The fields are additive and gated on the OTel plugin being active.
Does this require an RFC?
No; proposed as additive logging interoperability.
Additional Context
- JavaScript: OTel plugin: emit OTel severity fields (severityText/severityNumber) on patched logs, not only
levelaws-durable-execution-sdk-js#1228 - Python: [Feature]: OTel plugin: emit severityText and severityNumber on enriched logs aws-durable-execution-sdk-python#938
- Conformance coverage: [Requirement]: Assert OTel severity fields on SDK structured logs aws-durable-execution-conformance-tests#192
Activity