From 7a75c1c315c63a2de9acd4f8311422bb0cfba565 Mon Sep 17 00:00:00 2001 From: Harry Nguyen Date: Mon, 9 Nov 2026 21:05:45 -0700 Subject: [PATCH 1/4] feat(telemetry): add the telemetry-4 conformance handler Requirement telemetry-4 checks that full-tree operation detail exports a map, its two MapIteration contexts, and the step inside each iteration. The new handler Telemetry4FullTreeMap runs map process-items over the event with max concurrency 1 and item namer item-. Each iteration runs step greet-. TelemetryConformanceConfig gains a telemetryConfig overload that takes the operation detail, and fullTreeMapTelemetryConfig. The existing overloads delegate with TOP_LEVEL. The template maps Telemetry4FullTreeMap to telemetry-4. --- conformance-tests-telemetry/README.md | 7 ++- conformance-tests-telemetry/pom.xml | 2 +- .../telemetry/Telemetry4FullTreeMap.java | 48 +++++++++++++++++++ .../telemetry/TelemetryConformanceConfig.java | 41 +++++++++++++++- .../TelemetryConformanceConfigTest.java | 29 +++++++++++ conformance-tests-telemetry/template.yaml | 11 +++++ 6 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/Telemetry4FullTreeMap.java diff --git a/conformance-tests-telemetry/README.md b/conformance-tests-telemetry/README.md index c8085e38b..adf3ff7f4 100644 --- a/conformance-tests-telemetry/README.md +++ b/conformance-tests-telemetry/README.md @@ -21,6 +21,7 @@ template that maps it to the requirement ID. | `telemetry` | `telemetry-1` | One successful single-step execution emits one `SUCCEEDED` record with `input`, `output`, ARN-derived identity fields, and `operationsByName`. | | `telemetry` | `telemetry-2` | One failed execution emits one `FAILED` record with an `error` on the execution and on `operationsByName.charge`. | | `telemetry` | `telemetry-3` | An `OperationOverride.withResult` transform exports exactly `{userId}` of a three-key step result; the record has no `input` or `output`. | +| `telemetry` | `telemetry-4` | `FULL_TREE` operation detail exports a map, its two `MapIteration` contexts, and the step inside each, five keys in `operationsByName`. | ## Layout @@ -31,9 +32,10 @@ src/main/java/software/amazon/lambda/durable/conformance/telemetry/ Telemetry1Success.java # single step "increment"; plugin + CloudWatchLogsExporter Telemetry2Failure.java # step "charge" fails; handler throws "payment failed" with the step error as cause Telemetry3ResultSelect.java # step "fetch-user"; override transform keeps only userId in the record + Telemetry4FullTreeMap.java # map "process-items" over the event; iterations item-N; step greet-N; FULL_TREE detail TelemetryConformanceConfig.java # shared log-group guard and plugin config; every handler calls it src/test/java/software/amazon/lambda/durable/conformance/telemetry/ - TelemetryConformanceConfigTest.java # guard rejects null/blank; telemetry settings match the runner; telemetry-3 transform and content section + TelemetryConformanceConfigTest.java # guard rejects null/blank; telemetry settings match the runner; telemetry-3 transform and content section; telemetry-4 full-tree settings ``` The handlers use the real SDK API only. They construct no record and call no exporter method. A missing or wrong @@ -41,7 +43,8 @@ record is the plugin's defect. That defect is the signal the suite measures. The handler configuration is: one `CloudWatchLogsExporter`, emit mode `ON_COMPLETE`, sampling rate 1, operation detail `TOP_LEVEL`, and content input and output enabled. telemetry-3 differs in the content section only: input and output are -disabled, and one `OperationOverride.withResult("fetch-user", ...)` transform selects `userId` from the step result. +disabled, and one `OperationOverride.withResult("fetch-user", ...)` transform selects `userId` from the step result. telemetry-4 differs in the operation detail only: `FULL_TREE`, with input and output +enabled and no overrides. ## Template contract diff --git a/conformance-tests-telemetry/pom.xml b/conformance-tests-telemetry/pom.xml index 37f671e11..835e6f323 100644 --- a/conformance-tests-telemetry/pom.xml +++ b/conformance-tests-telemetry/pom.xml @@ -21,7 +21,7 @@ AWS Lambda Durable Execution SDK Telemetry Conformance Tests Java SDK handlers and SAM template for the Durable Execution Telemetry conformance - suite (telemetry-1, telemetry-2, telemetry-3). + suite (telemetry-1, telemetry-2, telemetry-3, telemetry-4). diff --git a/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/Telemetry4FullTreeMap.java b/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/Telemetry4FullTreeMap.java new file mode 100644 index 000000000..8c1dfce99 --- /dev/null +++ b/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/Telemetry4FullTreeMap.java @@ -0,0 +1,48 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +package software.amazon.lambda.durable.conformance.telemetry; + +import java.util.List; +import software.amazon.lambda.durable.DurableConfig; +import software.amazon.lambda.durable.DurableContext; +import software.amazon.lambda.durable.DurableHandler; +import software.amazon.lambda.durable.config.MapConfig; + +/** + * Full-tree operation detail for requirement telemetry-4. + * + *

The map {@code process-items} runs one iteration per item with max concurrency 1. The item namer names each + * iteration {@code item-}. Each iteration runs one step {@code greet-}. The plugin runs with full-tree + * operation detail. So the record keeps the map, both iteration contexts, and both steps, one key per name. + * + *

The handler uses the event as the item list. The runner sends {@code [1, 2]}. The handler constructs no record and + * calls no exporter method. The plugin builds and exports the record. + */ +public final class Telemetry4FullTreeMap extends DurableHandler, List> { + + // Class initialization fails when the variable is unset. See TelemetryConformanceConfig.requireLogGroupName. + private static final String LOG_GROUP_NAME = + TelemetryConformanceConfig.requireLogGroupName(System.getenv(TelemetryConformanceConfig.LOG_GROUP_ENV)); + + @Override + protected DurableConfig createConfiguration() { + return TelemetryConformanceConfig.durableConfig( + TelemetryConformanceConfig.fullTreeMapTelemetryConfig(LOG_GROUP_NAME)); + } + + @Override + public List handleRequest(List input, DurableContext context) { + var config = MapConfig.builder() + .maxConcurrency(1) + .itemNamer((item, index) -> "item-" + item) + .build(); + return context.map( + TelemetryConformanceConfig.FULL_TREE_MAP_NAME, + input, + String.class, + (item, index, ctx) -> + ctx.step("greet-" + item, String.class, stepCtx -> "Hello, " + item + "!"), + config) + .results(); + } +} diff --git a/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfig.java b/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfig.java index a6c9d0988..b6ba080e4 100644 --- a/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfig.java +++ b/conformance-tests-telemetry/src/main/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfig.java @@ -27,6 +27,9 @@ final class TelemetryConformanceConfig { /** Name of the telemetry-3 step. The override and the step call must use the same string. */ static final String RESULT_SELECT_STEP_NAME = "fetch-user"; + /** Name of the telemetry-4 map. The handler's map call uses this string. */ + static final String FULL_TREE_MAP_NAME = "process-items"; + private TelemetryConformanceConfig() {} /** @@ -74,17 +77,53 @@ static DurableExecutionTelemetryConfig telemetryConfig(String logGroupName) { * @return the plugin settings with the shared fields fixed and the given content */ static DurableExecutionTelemetryConfig telemetryConfig(String logGroupName, ContentConfig content) { + return telemetryConfig(logGroupName, DurableExecutionTelemetryConfig.OperationDetail.TOP_LEVEL, content); + } + + /** + * Builds the telemetry plugin settings with a caller-supplied operation detail and content section. + * + *

This overload holds the settings every handler shares: one CloudWatch Logs exporter, emit on completion, and a + * sampling rate of 1. The operation detail and content differ per requirement. telemetry-1 to telemetry-3 use + * top-level detail. telemetry-4 uses full-tree detail. So both are parameters. + * + * @param logGroupName the log group the exporter writes to + * @param operationDetail which operations the record keeps + * @param content the content section for the requirement the handler covers + * @return the plugin settings with the shared fields fixed + */ + static DurableExecutionTelemetryConfig telemetryConfig( + String logGroupName, + DurableExecutionTelemetryConfig.OperationDetail operationDetail, + ContentConfig content) { return DurableExecutionTelemetryConfig.builder() .addExporter(CloudWatchLogsExporter.builder() .logGroupName(logGroupName) .build()) .emitMode(DurableExecutionTelemetryConfig.EmitMode.ON_COMPLETE) .samplingRate(1.0) - .operationDetail(DurableExecutionTelemetryConfig.OperationDetail.TOP_LEVEL) + .operationDetail(operationDetail) .content(content) .build(); } + /** + * Builds the telemetry-4 settings: the shared exporter and modes, full-tree operation detail, input and output + * included, and no overrides. + * + *

Full-tree detail keeps the map iteration contexts and the steps inside them. telemetry-4 requires all five + * operations in {@code operationsByName}, so no filter and no override may remove one. + * + * @param logGroupName the log group the exporter writes to + * @return the plugin settings the telemetry-4 handler uses + */ + static DurableExecutionTelemetryConfig fullTreeMapTelemetryConfig(String logGroupName) { + return telemetryConfig( + logGroupName, + DurableExecutionTelemetryConfig.OperationDetail.FULL_TREE, + ContentConfig.builder().input(true).output(true).build()); + } + /** * Builds the telemetry-3 settings: the shared exporter and modes, no input, no output, and one result override on * {@link #RESULT_SELECT_STEP_NAME} that applies {@link #selectUserId(Object)}. diff --git a/conformance-tests-telemetry/src/test/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfigTest.java b/conformance-tests-telemetry/src/test/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfigTest.java index 39198b194..7bd2be190 100644 --- a/conformance-tests-telemetry/src/test/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfigTest.java +++ b/conformance-tests-telemetry/src/test/java/software/amazon/lambda/durable/conformance/telemetry/TelemetryConformanceConfigTest.java @@ -10,6 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static software.amazon.lambda.durable.telemetry.DurableExecutionTelemetryConfig.EmitMode.ON_COMPLETE; +import static software.amazon.lambda.durable.telemetry.DurableExecutionTelemetryConfig.OperationDetail.FULL_TREE; import static software.amazon.lambda.durable.telemetry.DurableExecutionTelemetryConfig.OperationDetail.TOP_LEVEL; import java.util.Map; @@ -103,4 +104,32 @@ void resultSelectTelemetryConfigOverridesTheStepResultWithTheSelectingTransform( assertNotNull(override.result()); assertEquals(Map.of("userId", "u-123"), override.result().apply(PARSED_FETCH_USER_RESULT)); } + + @Test + void fullTreeMapTelemetryConfigKeepsTheSharedSettings() { + var config = TelemetryConformanceConfig.fullTreeMapTelemetryConfig(LOG_GROUP); + assertEquals(1, config.exporters().size()); + assertInstanceOf(CloudWatchLogsExporter.class, config.exporters().get(0)); + assertEquals(ON_COMPLETE, config.emitMode()); + assertEquals(1.0, config.samplingRate()); + } + + @Test + void fullTreeMapTelemetryConfigUsesFullTreeDetailWithInputOutputAndNoOverrides() { + var config = TelemetryConformanceConfig.fullTreeMapTelemetryConfig(LOG_GROUP); + assertEquals(FULL_TREE, config.operationDetail()); + assertTrue(config.content().includeInput()); + assertTrue(config.content().includeOutput()); + assertTrue(config.content().overrides().isEmpty()); + } + + @Test + void otherConfigsStillUseTopLevelDetail() { + assertEquals( + TOP_LEVEL, + TelemetryConformanceConfig.telemetryConfig(LOG_GROUP).operationDetail()); + assertEquals( + TOP_LEVEL, + TelemetryConformanceConfig.resultSelectTelemetryConfig(LOG_GROUP).operationDetail()); + } } diff --git a/conformance-tests-telemetry/template.yaml b/conformance-tests-telemetry/template.yaml index aa0b7aab4..085efdfe7 100644 --- a/conformance-tests-telemetry/template.yaml +++ b/conformance-tests-telemetry/template.yaml @@ -65,3 +65,14 @@ Resources: CodeUri: . Handler: software.amazon.lambda.durable.conformance.telemetry.Telemetry3ResultSelect Role: !Ref LambdaExecutionRoleArn + + Telemetry4FullTreeMap: + Type: AWS::Serverless::Function + DependsOn: TelemetryLogGroup + TestingMetadata: + TestDescription: + - telemetry-4 + Properties: + CodeUri: . + Handler: software.amazon.lambda.durable.conformance.telemetry.Telemetry4FullTreeMap + Role: !Ref LambdaExecutionRoleArn From cf7dfab51d743df38dae3fa4954fcb0a198e0bbc Mon Sep 17 00:00:00 2001 From: Harry Nguyen Date: Mon, 9 Nov 2026 21:20:51 -0700 Subject: [PATCH 2/4] ci(telemetry): pin the conformance suite to the telemetry-4 branch head The telemetry-4 requirement is not on the conformance main branch yet. The e2e run needs it. So this pins the shared workflow to the head of feat/telemetry-4-full-tree-map (c7abf1b). Re-pin to the merge commit once that PR merges. --- .github/workflows/telemetry-conformance-tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/telemetry-conformance-tests.yml b/.github/workflows/telemetry-conformance-tests.yml index 507b43b86..2d4168f23 100644 --- a/.github/workflows/telemetry-conformance-tests.yml +++ b/.github/workflows/telemetry-conformance-tests.yml @@ -43,9 +43,10 @@ jobs: contents: read id-token: write # The pinned SHA also selects the runner and telemetry-extension revision the shared - # workflow installs, so it must be reachable from a branch. It is the merge commit of - # aws-durable-execution-conformance-tests PR #183 on that repository's main branch. - uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@cf13ef27d6e13a4423f7e0a178f9a3d4bb1099f0 + # workflow installs, so it must be reachable from a branch. It is the head of branch + # feat/telemetry-4-full-tree-map in aws-durable-execution-conformance-tests (issue #184). + # Re-pin to the merge commit on main once that PR merges. + uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@c7abf1b46c301c3a92308a63d4954447060db44d with: language: java resource_prefix: java From fcc7a5f899b374455b8a91cd026b5943e9d3c37f Mon Sep 17 00:00:00 2001 From: Harry Nguyen Date: Tue, 10 Nov 2026 13:49:22 -0700 Subject: [PATCH 3/4] ci(telemetry): re-pin the conformance suite to the rebased telemetry-4 head Conformance PR #185 was stacked on the telemetry-3 branch. Telemetry-3 was squash-merged, so the PR branch was rebased onto main and force-pushed. The old head c7abf1b is no longer reachable from a branch. The new head 5c75e3f has an identical tree. Re-pin to the merge commit once #185 merges. --- .github/workflows/telemetry-conformance-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-conformance-tests.yml b/.github/workflows/telemetry-conformance-tests.yml index 2d4168f23..f3afc5751 100644 --- a/.github/workflows/telemetry-conformance-tests.yml +++ b/.github/workflows/telemetry-conformance-tests.yml @@ -46,7 +46,7 @@ jobs: # workflow installs, so it must be reachable from a branch. It is the head of branch # feat/telemetry-4-full-tree-map in aws-durable-execution-conformance-tests (issue #184). # Re-pin to the merge commit on main once that PR merges. - uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@c7abf1b46c301c3a92308a63d4954447060db44d + uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@5c75e3f2d8e31d959114547bedad9c18afa0884b with: language: java resource_prefix: java From d416efec42b7e5bd238f208f4b76f7249828e16a Mon Sep 17 00:00:00 2001 From: Harry Nguyen Date: Tue, 10 Nov 2026 15:35:32 -0700 Subject: [PATCH 4/4] ci(telemetry): pin the conformance suite to the telemetry-4 merge commit Conformance PR #185 merged to main as b380cbf. Its tree is identical to the branch head 5c75e3f that CI ran against. Pin to the merge commit so the revision stays reachable after the feature branch is deleted. --- .github/workflows/telemetry-conformance-tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/telemetry-conformance-tests.yml b/.github/workflows/telemetry-conformance-tests.yml index f3afc5751..5eb3063d1 100644 --- a/.github/workflows/telemetry-conformance-tests.yml +++ b/.github/workflows/telemetry-conformance-tests.yml @@ -43,10 +43,9 @@ jobs: contents: read id-token: write # The pinned SHA also selects the runner and telemetry-extension revision the shared - # workflow installs, so it must be reachable from a branch. It is the head of branch - # feat/telemetry-4-full-tree-map in aws-durable-execution-conformance-tests (issue #184). - # Re-pin to the merge commit on main once that PR merges. - uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@5c75e3f2d8e31d959114547bedad9c18afa0884b + # workflow installs, so it must be reachable from a branch. It is the merge commit of + # aws-durable-execution-conformance-tests PR #185 on that repository's main branch. + uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@b380cbf19bbc4f08a2d7c593d4bf24f585946415 with: language: java resource_prefix: java