Skip to content

Commit c7d68bd

Browse files
vitalii-chura-axonvcvitaly
authored andcommitted
Add theme, color mode and Linux platform version to tags reported to Sentry (#660)
1 parent 616672c commit c7d68bd

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ dependencies {
140140
implementation 'org.apache.commons:commons-text:1.10.0'
141141
implementation 'io.sentry:sentry:6.24.0'
142142

143+
implementation 'com.jsoftbiz:os-platform-finder:1.1'
144+
143145
// when updating the versions here, also update them in AsciiDocDownloaderUtil for dynamic download
144146
testImplementation 'org.asciidoctor:asciidoctorj-diagram:2.2.9'
145147
testImplementation 'org.asciidoctor:asciidoctorj-pdf:2.3.7'

src/main/java/org/asciidoc/intellij/errorHandler/SentryErrorReporter.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
import com.intellij.openapi.diagnostic.Attachment;
1212
import com.intellij.openapi.diagnostic.Logger;
1313
import com.intellij.openapi.diagnostic.SubmittedReportInfo;
14+
import com.intellij.openapi.editor.colors.EditorColorsManager;
1415
import com.intellij.openapi.extensions.PluginId;
1516
import com.intellij.openapi.util.SystemInfo;
17+
import com.intellij.openapi.util.SystemInfoRt;
1618
import com.intellij.openapi.util.text.StringUtil;
1719
import com.intellij.util.Consumer;
20+
import com.jsoftbiz.utils.OS;
1821
import io.sentry.DuplicateEventDetectionEventProcessor;
1922
import io.sentry.ILogger;
2023
import io.sentry.Sentry;
@@ -30,6 +33,7 @@
3033
import org.jetbrains.annotations.NotNull;
3134
import org.jetbrains.annotations.Nullable;
3235

36+
import javax.swing.UIManager;
3337
import java.nio.charset.StandardCharsets;
3438
import java.util.Formatter;
3539
import java.util.HashMap;
@@ -113,6 +117,11 @@ public boolean isEnabled(@Nullable SentryLevel level) {
113117

114118
event.setTag("java_vendor", SystemInfo.JAVA_VENDOR);
115119
event.setTag("java_version", SystemInfo.JAVA_VERSION);
120+
event.setTag("ui.theme", getUiTheme());
121+
event.setTag("ui.dark", getUiMode());
122+
if (SystemInfoRt.isLinux) {
123+
event.setTag("linux_platform", getLinuxPlatformName());
124+
}
116125

117126
// clear the server name, as it is of no use to analyze the error
118127
event.setServerName(null);
@@ -234,4 +243,16 @@ private static void fillActivePlugins(Contexts contexts) {
234243
contexts.put("active plugins", activePlugins);
235244
}
236245
}
246+
247+
private static String getUiTheme() {
248+
return UIManager.getLookAndFeel().getName();
249+
}
250+
251+
private static String getUiMode() {
252+
return String.valueOf(EditorColorsManager.getInstance().isDarkEditor());
253+
}
254+
255+
private static String getLinuxPlatformName() {
256+
return OS.OS.getPlatformName();
257+
}
237258
}

0 commit comments

Comments
 (0)