Fixes the cache for the KMS encryption plugin.#6636
Merged
dlvenable merged 1 commit intoMar 13, 2026
Conversation
The cache was using byte[] as the key. As an array it doesn't have equals/hashCode so the keys would never be found. To cache it correctly I use SdkBytes which implements both. I also added three metrics for the KMS plugin: 1. A gauge on decrypted keys in the cache; 2. KMS requests succeeded; 3. KMS requests failed. Signed-off-by: David Venable <dlv@amazon.com>
sb2k16
approved these changes
Mar 13, 2026
graytaylor0
approved these changes
Mar 13, 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.
Description
The cache was using
byte[]as the key. As an array it doesn't haveequals/hashCodeso the keys would never be found. To cache it correctly I useSdkByteswhich implements both.Additionally the tests appeared to be passing. But there is a subtle issue with them. The
verifycall happened before the second call. TheverifyNoMoreInteractionsappears to not verify based on counts. Just by moving theverifycall below the second call I was able to get the tests to fail before fixing the code.I also added three metrics for the KMS plugin:
You can see the issue using the metrics:
Here it is with the fix:
Note, that I renamed the new metric after taking the screenshots to remove the redundant "count."
Issues Resolved
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.