Investigate how billing will be affected by switching to RepositoryInfo rpc
Follow up issue for discussion on how to proceed with switching from RepositorySize to RepositoryInfo.
We are concerned that rolling out the RepositoryInfo rpc could affect billing. We need to investigate how the new RepositoryInfo stats compare to the old RepositorySize stats.
But if we want to be extra careful with this change, then we can run both
RepositoryInfoandRepositorySizefor percentage of calls and compare their values to ensure that there are no discrepancies.Some pseudocode to describe the idea.
if Feature.enabled?(:use_repository_info_for_repository_size) bytes = gitaly_repository_client.repository_info.size (bytes.to_f / 1024 / 1024).round(2) else kilobytes = gitaly_repository_client.repository_size repository_size_megabytes = (kilobytes.to_f / 1024).round(2) if Feature.enabled?(:test_repository_info_for_repository_size) bytes = gitaly_repository_client.repository_info.size repository_info_megabytes = (bytes.to_f / 1024 / 1024).round(2) if repository_info_megabytes != repository_size_megabytes log("Discrepancy between RepositorySize (#{repository_size_megabytes}) and RepositoryInfo (#{repository_info_megabytes})", project_id: project_id) end end repository_size_megabytes endWe can run this version for 10% of calls (for example) and if there are no errors in logs for a week then it will be a confirmation that the feature flag is safe to enable.