fix: Send the process exit reason to Sentry + add OS info

This commit is contained in:
Jakub Blach 2025-07-10 18:47:06 +02:00
parent 254774ca2a
commit b72fc0ea8f
4 changed files with 15 additions and 8 deletions

View file

@ -13,7 +13,6 @@ import com.github.continuedev.continueintellijextension.utils.*
import com.google.gson.Gson
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.SelectionModel
import com.intellij.openapi.fileEditor.FileEditorManager

View file

@ -26,7 +26,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.guessProjectDir
import com.intellij.openapi.util.IconLoader
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiDocumentManager

View file

@ -1,5 +1,6 @@
package com.github.continuedev.continueintellijextension.`continue`.process
import com.github.continuedev.continueintellijextension.error.ContinueErrorService
import com.github.continuedev.continueintellijextension.services.TelemetryService
import com.github.continuedev.continueintellijextension.utils.OS
import com.github.continuedev.continueintellijextension.utils.getContinueBinaryPath
@ -44,11 +45,8 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess {
err = err.substring(doneIndex + delimiter.length)
}
}
println("Core process exited with output: $err")
val telemetryService = service<TelemetryService>()
telemetryService.capture("jetbrains_core_exit", mapOf("error" to err))
service<ContinueErrorService>().reportMessage("Core process exited with output: $err")
service<TelemetryService>().capture("jetbrains_core_exit", mapOf("error" to err))
}
private companion object {
@ -67,6 +65,7 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess {
elevatePermissions()
}
// todo: consider setting permissions ahead-of-time during build/packaging, not at runtime
private fun elevatePermissions() {
val path = getContinueBinaryPath()
val permissions = setOf(

View file

@ -6,6 +6,7 @@ import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.Attachment
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.PluginId
import com.intellij.openapi.util.SystemInfo
import com.intellij.ui.jcef.JBCefApp
import io.sentry.Hint
import io.sentry.Sentry
@ -26,6 +27,8 @@ class ContinueErrorService {
config.setTag("ide_version", ApplicationInfo.getInstance().build.asString())
config.setTag("jcef_supported", JBCefApp.isSupported().toString())
config.setTag("plugin_version", PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID))?.version)
config.setTag("system", SystemInfo.OS_NAME)
config.setTag("system_version", SystemInfo.OS_VERSION)
}
}
@ -39,7 +42,14 @@ class ContinueErrorService {
sentryEvent.message = Message().apply { this.message = message }
val hint = Hint.withAttachments(attachments?.map { SentryAttachment(it.bytes, it.path) })
Sentry.captureEvent(sentryEvent, hint)
log.warn("Problem sent to Sentry: $message", throwable)
log.warn("Exception sent to Sentry: $message", throwable)
}
fun reportMessage(
message: String,
) {
Sentry.captureMessage(message)
log.warn("Message sent to Sentry: $message")
}
private companion object {