Merge pull request #1969 from vector-im/feature/bma/rageshakeTraceConfig
Feature/bma/rageshake trace config
This commit is contained in:
10
.idea/migrations.xml
generated
Normal file
10
.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -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)
|
||||
|
||||
@@ -47,4 +47,9 @@ interface BugReporter {
|
||||
* Provide the log directory.
|
||||
*/
|
||||
fun logDirectory(): File
|
||||
|
||||
/**
|
||||
* Set the current tracing filter.
|
||||
*/
|
||||
fun setCurrentTracingFilter(tracingFilter: String)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import io.element.android.libraries.core.meta.BuildMeta
|
||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.di.SingleIn
|
||||
import io.element.android.libraries.network.useragent.UserAgentProvider
|
||||
import io.element.android.libraries.sessionstorage.api.SessionStore
|
||||
import io.element.android.services.toolbox.api.systemclock.SystemClock
|
||||
@@ -63,6 +64,7 @@ import javax.inject.Provider
|
||||
/**
|
||||
* BugReporter creates and sends the bug reports.
|
||||
*/
|
||||
@SingleIn(AppScope::class)
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultBugReporter @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
@@ -86,10 +88,10 @@ class DefaultBugReporter @Inject constructor(
|
||||
|
||||
// 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", "*:*")
|
||||
private var currentTracingFilter: String? = null
|
||||
|
||||
override suspend fun sendBugReport(
|
||||
withDevicesLogs: Boolean,
|
||||
@@ -153,6 +155,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 +328,10 @@ class DefaultBugReporter @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun setCurrentTracingFilter(tracingFilter: String) {
|
||||
currentTracingFilter = tracingFilter
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the files on the log directory.
|
||||
*/
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user