Repository navigation
feat(telemetry): add the telemetry-3 conformance handler #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7f7c177
feat(telemetry): add the telemetry-3 conformance handler
hln33 d4aca51
ci(telemetry): pin the suite to head of conformance PR #183
hln33 419e4e7
docs(telemetry): address review on #882
hln33 e445605
ci(telemetry): pin the suite to the #183 merge commit on main
hln33 f8ac60b
Merge origin/main into feat/conformance-telemetry-3
hln33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
66 changes: 66 additions & 0 deletions
66
...ain/java/software/amazon/lambda/durable/conformance/telemetry/Telemetry3ResultSelect.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| package software.amazon.lambda.durable.conformance.telemetry; | ||
|
|
||
| import software.amazon.lambda.durable.DurableConfig; | ||
| import software.amazon.lambda.durable.DurableContext; | ||
| import software.amazon.lambda.durable.DurableHandler; | ||
|
|
||
| /** | ||
| * Per-operation result selection for requirement telemetry-3. | ||
| * | ||
| * <p>The step {@code fetch-user} returns {@code {userId, email, token}}. The plugin exports an operation's result only | ||
| * when an {@code OperationOverride.withResult} transform opts the operation in. The transform | ||
| * {@link TelemetryConformanceConfig#selectUserId(Object)} returns a new map that holds {@code userId} alone. So the | ||
| * record's {@code operationsByName.fetch-user.result} is exactly {@code {"userId": "u-123"}}, and {@code email} and | ||
| * {@code token} never reach CloudWatch Logs. | ||
| * | ||
| * <p>The content section also excludes input and output. telemetry-3 requires that the record carry no {@code input} | ||
| * and no {@code output} key. The execution result still holds all three keys, so the core {@code ExpectedResult} check | ||
| * proves the transform removed data from the record, not from the step. | ||
| * | ||
| * <p>The handler constructs no record and calls no exporter method. The plugin builds and exports the record. | ||
| */ | ||
| public final class Telemetry3ResultSelect | ||
| extends DurableHandler<Telemetry3ResultSelect.Input, Telemetry3ResultSelect.Output> { | ||
|
|
||
| // 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.resultSelectTelemetryConfig(LOG_GROUP_NAME)); | ||
| } | ||
|
|
||
| @Override | ||
| public Output handleRequest(Input input, DurableContext context) { | ||
| return context.step( | ||
| TelemetryConformanceConfig.RESULT_SELECT_STEP_NAME, | ||
| Output.class, | ||
| step -> new Output(input.userId, "test@example.com", "tok-456")); | ||
| } | ||
|
|
||
| /** Event payload: {"userId": "u-123"}. */ | ||
| public static final class Input { | ||
| public String userId; | ||
|
|
||
| public Input() {} | ||
| } | ||
|
|
||
| /** Step and execution result: {"userId": "u-123", "email": "test@example.com", "token": "tok-456"}. */ | ||
| public static final class Output { | ||
| public String userId; | ||
| public String email; | ||
| public String token; | ||
|
|
||
| public Output() {} | ||
|
|
||
| public Output(String userId, String email, String token) { | ||
| this.userId = userId; | ||
| this.email = email; | ||
| this.token = token; | ||
| } | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.