Improve debug logging for reconciliation.

This commit is contained in:
Greyson Parrelli
2025-09-12 12:02:04 -04:00
committed by Cody Henthorne
parent c19017f037
commit 9021883baa
5 changed files with 124 additions and 61 deletions

View File

@@ -11,7 +11,6 @@ import org.signal.donations.InAppPaymentType
import org.thoughtcrime.securesms.backup.v2.ArchiveRestoreProgress
import org.thoughtcrime.securesms.components.settings.app.subscription.DonationSerializationHelper.toFiatMoney
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository
import org.thoughtcrime.securesms.database.AttachmentTable
import org.thoughtcrime.securesms.database.SignalDatabase
import org.thoughtcrime.securesms.database.model.InAppPaymentSubscriberRecord
import org.thoughtcrime.securesms.dependencies.AppDependencies
@@ -94,42 +93,12 @@ class LogSectionRemoteBackups : LogSection {
}
output.append("\n -- Attachment Stats\n")
output.append(SignalDatabase.attachments.debugGetAttachmentStats().toPrettyString())
output.append(SignalDatabase.attachments.debugGetAttachmentStats().prettyString())
return output
}
}
private fun AttachmentTable.DebugAttachmentStats.toPrettyString(): String {
return buildString {
appendLine("Total attachment rows: $totalAttachmentRows")
appendLine("Total eligible for upload rows: $totalEligibleForUploadRows")
appendLine("Total unique media names eligible for upload: $totalUniqueMediaNamesEligibleForUpload")
appendLine("Total unique data files: $totalUniqueDataFiles")
appendLine("Total unique media names: $totalUniqueMediaNames")
appendLine("Media names with thumbnails count: $mediaNamesWithThumbnailsCount")
appendLine("Pending attachment upload bytes: $pendingAttachmentUploadBytes")
appendLine("Uploaded attachment bytes: $uploadedAttachmentBytes")
appendLine("Uploaded thumbnail bytes: $uploadedThumbnailBytes")
appendLine("Total upload count: $totalUploadCount")
appendLine("Total upload bytes: $totalUploadBytes")
if (archiveStatusMediaNameCounts.isNotEmpty()) {
appendLine("Archive status media name counts:")
archiveStatusMediaNameCounts.forEach { (state, count) ->
appendLine(" ${state.name}: $count")
}
}
if (archiveStatusMediaNameThumbnailCounts.isNotEmpty()) {
appendLine("Archive status media name thumbnail counts:")
archiveStatusMediaNameThumbnailCounts.forEach { (state, count) ->
appendLine(" ${state.name}: $count")
}
}
}
}
private fun ArchiveUploadProgressState.toPrettyString(): String {
return buildString {
appendLine("state: ${state.name}")