From 5d02e362dd7b32116cd923df3b7bbb9719cf8066 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Mon, 7 Jul 2025 17:17:07 +0200 Subject: [PATCH] fix: Attach environment type to reported exceptions Motivation: * Everything right now goes under "production" and it's hard to distinguish exceptions that I triggered myself during development from real ones. * In Sentry, there is an issue called JobCancellationException, which I believe is related to ci/e2e tests. I want to recognize that. * It's a common practice to distinguish environments, and it will be easy to hide non-production issues (with query like `?environment=production`). Introduced types: * production (default) * dev (when `runIde`) * e2e (when robot enabled) --- .../error/ContinueErrorService.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt index b1fdae571..21f920ef9 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt @@ -21,6 +21,7 @@ class ContinueErrorService { init { Sentry.init { config -> config.dsn = SENTRY_DSN + config.environment = recognizeEnvironment() config.isSendDefaultPii = false config.setTag("ide_version", ApplicationInfo.getInstance().build.asString()) config.setTag("jcef_supported", JBCefApp.isSupported().toString()) @@ -45,6 +46,12 @@ class ContinueErrorService { private const val PLUGIN_ID = "com.github.continuedev.continueintellijextension" private const val SENTRY_DSN = "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016" - } + private fun recognizeEnvironment() = + when { + System.getProperty("robot-server.port") != null -> "e2e" + System.getProperty("idea.is.internal").toBoolean() -> "dev" + else -> "production" + } + } } \ No newline at end of file