-
Notifications
You must be signed in to change notification settings - Fork 6
sch-UID2-5853 Added logs for key bucket count in salt rotation #568
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
Changes from 2 commits
8101bf1
9b6ad96
079eac4
715f418
dfcdd37
82de10b
6c94276
7d812aa
c51f67b
c6d71c9
62c5270
adac568
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ public Result rotateSalts( | |
| logSaltAges("refreshable-salts", targetDate, refreshableSalts); | ||
| logSaltAges("rotated-salts", targetDate, saltsToRotate); | ||
| logSaltAges("total-salts", targetDate, Arrays.asList(postRotationSalts)); | ||
| logBucketFormatCount(targetDate, preRotationSalts, postRotationSalts); | ||
|
|
||
| var nextSnapshot = new SaltSnapshot( | ||
| nextEffective, | ||
|
|
@@ -246,6 +247,22 @@ private void logSaltAges(String saltCountType, TargetDate targetDate, Collection | |
| } | ||
| } | ||
|
|
||
| private void logBucketFormatCount(TargetDate targetDate, SaltEntry[] preRotationSalts, SaltEntry[] postRotationSalts) { | ||
| int newKeyBucketCounter = 0, totalKeyBucketCounter = 0, totalSaltBucketCounter = 0; | ||
|
|
||
| for (int i = 0; i < preRotationSalts.length && i < postRotationSalts.length; i++) { | ||
| var oldSalt = preRotationSalts[i]; | ||
| var updatedSalt = postRotationSalts[i]; | ||
|
|
||
| if (updatedSalt.currentKey() != null) totalKeyBucketCounter++; | ||
|
||
| if (updatedSalt.currentSalt() != null) totalSaltBucketCounter++; | ||
| if (updatedSalt.currentKey() != null && oldSalt.currentSalt() != null) newKeyBucketCounter++; | ||
| } | ||
|
|
||
| LOGGER.info("Salt rotation bucket format: target_date={} new_key_bucket_count={} total_key_bucket_count={} total_salt_bucket_count={}", | ||
|
||
| targetDate, newKeyBucketCounter, totalKeyBucketCounter, totalSaltBucketCounter); | ||
| } | ||
|
|
||
| @Getter | ||
| public static final class Result { | ||
| private final SaltSnapshot snapshot; // can be null if new snapshot is not needed | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this deserves a comment - mention the migration, that the salts are the old format and we're transitioning to encryption keys. Mention that this is to monitor the migration.