Send the tracing configuration with the rageshake data.

This commit is contained in:
Benoit Marty
2023-12-06 17:35:52 +01:00
parent f3318078f2
commit ed64403dec
4 changed files with 18 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ class TracingInitializer : Initializer<Unit> {
)
}
bugReporter.cleanLogDirectoryIfNeeded()
bugReporter.setCurrentTracingFilter(tracingConfiguration.filterConfiguration.filter)
tracingService.setupTracing(tracingConfiguration)
// Also set env variable for rust back trace
Os.setenv("RUST_BACKTRACE", "1", true)

View File

@@ -47,4 +47,9 @@ interface BugReporter {
* Provide the log directory.
*/
fun logDirectory(): File
/**
* Set the current tracing filter.
*/
fun setCurrentTracingFilter(tracingFilter: String)
}

View File

@@ -82,11 +82,11 @@ class DefaultBugReporter @Inject constructor(
private const val LOG_CAT_FILENAME = "logcat.log"
private const val LOG_DIRECTORY_NAME = "logs"
private const val BUFFER_SIZE = 1024 * 1024 * 50
var currentTracingFilter: String? = null
}
// the pending bug report call
private var bugReportCall: Call? = null
// boolean to cancel the bug report
private val isCancelled = false
private val logcatCommandDebug = arrayOf("logcat", "-d", "-v", "threadtime", "*:*")
@@ -153,6 +153,9 @@ class DefaultBugReporter @Inject constructor(
.addFormDataPart("device_id", deviceId)
.addFormDataPart("device", Build.MODEL.trim())
.addFormDataPart("locale", Locale.getDefault().toString())
currentTracingFilter?.let {
builder.addFormDataPart("tracing_filter", it)
}
// add the gzipped files, don't cancel the whole upload if only some file failed to upload
var uploadedSomeLogs = false
@@ -323,6 +326,10 @@ class DefaultBugReporter @Inject constructor(
}
}
override fun setCurrentTracingFilter(tracingFilter: String) {
currentTracingFilter = tracingFilter
}
/**
* @return the files on the log directory.
*/

View File

@@ -59,6 +59,10 @@ class FakeBugReporter(val mode: FakeBugReporterMode = FakeBugReporterMode.Succes
override fun logDirectory(): File {
return File("fake")
}
override fun setCurrentTracingFilter(tracingFilter: String) {
// No op
}
}
enum class FakeBugReporterMode {