Update the RustSDK and adopt the new tracing configuration that allows maximum size and age limits on all logs.

Set that 100Mb and a week and remove previous rageshake uploading checks as they are no longer required.
This commit is contained in:
Stefan Ceriu
2026-02-13 14:24:51 +02:00
committed by Stefan Ceriu
parent 2ee095554b
commit 8f9d507e28
10 changed files with 25 additions and 82 deletions
+9 -19
View File
@@ -10,9 +10,6 @@ import Foundation
import MatrixRustSDK
enum Tracing {
/// The base filename used for log files. This may be suffixed by the target
/// name and other log management metadata during rotation.
static let filePrefix = "console"
/// The directory that stores all of the log files.
static var logsDirectory: URL {
if ProcessInfo.isRunningIntegrationTests {
@@ -30,22 +27,13 @@ enum Tracing {
.appGroupContainerDirectory
}
static let fileExtension = "log"
static let fileExtension = ".log"
static func buildConfiguration(logLevel: LogLevel, traceLogPacks: Set<TraceLogPack>,
static func buildConfiguration(logLevel: LogLevel,
traceLogPacks: Set<TraceLogPack>,
currentTarget: String,
filePrefix: String?,
filePrefix: String,
sentryURL: URL?) -> TracingConfiguration {
let fileName = if let filePrefix {
"\(Tracing.filePrefix)-\(filePrefix)"
} else {
Tracing.filePrefix
}
// Keep a minimum of 1 week of log files. In reality it will be longer
// as the app is unlikely to be running continuously.
let maxFiles: UInt64 = 24 * 7
// Log everything on integration tests to check whether
// the logs contain any sensitive data. See `integration-tests.yml`
let level: LogLevel = ProcessInfo.isRunningIntegrationTests ? .trace : logLevel
@@ -55,9 +43,11 @@ enum Tracing {
extraTargets: [currentTarget],
writeToStdoutOrSystem: true,
writeToFiles: .init(path: logsDirectory.path(percentEncoded: false),
filePrefix: fileName,
filePrefix: filePrefix,
fileSuffix: fileExtension,
maxFiles: maxFiles),
// Total compressed size needs to be under CloudFlare's max request size of 50Mb
maxTotalSizeBytes: 100 * 1024 * 1024, // 100Mb
maxAgeSeconds: 7 * 24 * 60 * 60), // One week
sentryDsn: sentryURL?.absoluteString)
}
@@ -81,7 +71,7 @@ enum Tracing {
let modificationDate = resourceValues.contentModificationDate
else { continue }
if logURL.lastPathComponent.hasPrefix(filePrefix) {
if logURL.lastPathComponent.hasSuffix(fileExtension) {
logFiles.append((logURL, modificationDate))
}
}