Skip to content

Conversation

@sophia-chen-ttd
Copy link
Contributor

@sophia-chen-ttd sophia-chen-ttd commented Aug 25, 2025

After each salt rotation, logs:

  • number of buckets that have rotated from salt to key
  • total number of buckets that have a currentKey
  • total number of buckets that have a currentSalt

}

private void logBucketFormatCount(TargetDate targetDate, SaltEntry[] preRotationSalts, SaltEntry[] postRotationSalts) {
int newKeyBucketCounter = 0, totalKeyBucketCounter = 0, totalSaltBucketCounter = 0;
Copy link
Contributor

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.

var oldSalt = preRotationSalts[i];
var updatedSalt = postRotationSalts[i];

if (updatedSalt.currentKey() != null) totalKeyBucketCounter++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we also do the previous salt/keys?

Copy link
Contributor Author

@sophia-chen-ttd sophia-chen-ttd Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to monitor those - I'm not sure how helpful they would be in monitoring the migration?

Copy link
Contributor

@aulme aulme Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should start seeing the first "previous key" ~1 year after we start migration and we should stop seeing "previous salt" soon after that, at least by day 420. We can only remove the salt-related code after both all current and previous salts are gone.

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={}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be clearer that those are formats of buckets rotated just now, not for all bucket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are for all the buckets in snapshot, including those that haven't rotated, whereas the new_key_bucket_count are for buckets that have rotated just now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated new_key_bucket_count to migrated_key_bucket_count to hopefully make that clearer

@sophia-chen-ttd sophia-chen-ttd changed the title sch-UID2-5851 Added logs for key bucket count in salt rotation sch-UID2-5853 Added logs for key bucket count in salt rotation Aug 28, 2025
@sophia-chen-ttd sophia-chen-ttd merged commit d3f1587 into sch-UID2-5851-migration-to-key-rotation Aug 28, 2025
4 of 5 checks passed
@sophia-chen-ttd sophia-chen-ttd deleted the sch-UID2-5853-metrics-and-dashboard-for-key-rotation branch August 28, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants