Skip to content

Commit bc9ab10

Browse files
Merge pull request #11698 from yezhu6/yezhu/add-more-telemetry
Add more telemetry
2 parents 5c45e89 + b5e2140 commit bc9ab10

File tree

8 files changed

+21
-8
lines changed

8 files changed

+21
-8
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/common/AppModPluginInstaller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static void showInstallConfirmation(@Nonnull Project project, boolean for
111111
? "To upgrade your apps, you'll need two plugins: GitHub Copilot and app modernization."
112112
: "To migrate to Azure, you'll need two plugins: GitHub Copilot and app modernization.";
113113
}
114-
114+
AppModUtils.logTelemetryEvent("plugin." + action + ".install-prompt-shown", Map.of("copilotInstalled", String.valueOf(copilotInstalled)));
115115
if (Messages.showOkCancelDialog(project, message, title, "Install", "Cancel", Messages.getQuestionIcon()) == Messages.OK) {
116116
log.info("[AppModPluginInstaller] User confirmed plugin installation for {}", action);
117117
AppModUtils.logTelemetryEvent("plugin." + action + ".install-confirmed");

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/javaupgrade/action/CveFixDependencyInProblemsViewAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import lombok.extern.slf4j.Slf4j;
1919
import org.jetbrains.annotations.NotNull;
2020

21+
import java.util.Map;
22+
2123
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.utils.Constants.*;
2224
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.dao.VulnerabilityInfo.parseVulnerabilityDescription;
2325

@@ -55,7 +57,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
5557
vulnerabilityInfo.getDependencyCoordinate())
5658
);
5759
}
58-
AppModUtils.logTelemetryEvent("openCopilotChatForCveFixDependencyInProblemsViewAction");
60+
AppModUtils.logTelemetryEvent("openCopilotChatForCveFixDependencyInProblemsViewAction", Map.of("appmodPluginInstalled", String.valueOf(AppModPluginInstaller.isAppModPluginInstalled())));
5961
} catch (Throwable ex) {
6062
log.error("Failed to open Copilot chat for CVE fix", ex.getMessage());
6163
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/javaupgrade/action/CveFixInProblemsViewAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import lombok.extern.slf4j.Slf4j;
2020
import org.jetbrains.annotations.NotNull;
2121

22+
import java.util.Map;
23+
2224
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.utils.Constants.*;
2325

2426
/**
@@ -46,7 +48,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
4648
project,
4749
SCAN_AND_RESOLVE_CVES_PROMPT
4850
);
49-
AppModUtils.logTelemetryEvent("openCopilotChatForCveFixInProblemsViewAction");
51+
AppModUtils.logTelemetryEvent("openCopilotChatForCveFixInProblemsViewAction", Map.of("appmodPluginInstalled", String.valueOf(AppModPluginInstaller.isAppModPluginInstalled())));
5052
} catch (Throwable ex) {
5153
log.error("Failed to open Copilot chat for CVE fix", ex.getMessage());
5254
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/javaupgrade/action/CveFixIntentionAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import lombok.extern.slf4j.Slf4j;
2323
import org.jetbrains.annotations.NotNull;
2424

25+
import java.util.Map;
26+
2527
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.utils.Constants.SCAN_AND_RESOLVE_CVES_PROMPT;
2628
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.utils.Constants.SCAN_AND_RESOLVE_CVES_WITH_COPILOT_DISPLAY_NAME;
2729

@@ -106,7 +108,7 @@ public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws
106108
// Try to extract dependency information from the current context
107109
final String prompt = buildPromptFromContext();
108110
JavaVersionNotificationService.getInstance().openCopilotChatWithPrompt(project, prompt);
109-
AppModUtils.logTelemetryEvent("openCveFixCopilotChatFromIntentionAction");
111+
AppModUtils.logTelemetryEvent("openCveFixCopilotChatFromIntentionAction", Map.of("AppModPluginInstalled", String.valueOf(AppModPluginInstaller.isAppModPluginInstalled())));
110112
} catch (Throwable e) {
111113
log.error("Failed to invoke CveFixIntentionAction: ", e);
112114
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/javaupgrade/action/JavaUpgradeContextMenuAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import lombok.extern.slf4j.Slf4j;
1818
import org.jetbrains.annotations.NotNull;
1919

20+
import java.util.Map;
21+
2022
import static com.microsoft.azure.toolkit.intellij.appmod.common.AppModPluginInstaller.TO_INSTALL_APP_MODE_PLUGIN;
2123
import static com.microsoft.azure.toolkit.intellij.appmod.common.AppModPluginInstaller.isAppModPluginInstalled;
2224
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.utils.Constants.UPGRADE_JAVA_AND_FRAMEWORK_PROMPT;
@@ -58,7 +60,7 @@ public void update(@NotNull AnActionEvent e) {
5860
e.getPresentation().setText(e.getPresentation().getText() + TO_INSTALL_APP_MODE_PLUGIN);
5961
}
6062
if (visible){
61-
AppModUtils.logTelemetryEvent("showJavaUpgradeContextMenuAction");
63+
AppModUtils.logTelemetryEvent("showJavaUpgradeContextMenuAction", Map.of("appmodPluginInstalled", String.valueOf(isAppModPluginInstalled())));
6264
}
6365
e.getPresentation().setEnabledAndVisible(visible);
6466
} catch (Throwable ex) {
@@ -80,7 +82,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
8082

8183
// Open Copilot chat with the upgrade prompt
8284
JavaVersionNotificationService.getInstance().openCopilotChatWithPrompt(project, prompt);
83-
AppModUtils.logTelemetryEvent("openJavaUpgradeCopilotChatFromContextMenu");
85+
AppModUtils.logTelemetryEvent("openJavaUpgradeCopilotChatFromContextMenu", Map.of("appmodPluginInstalled", String.valueOf(isAppModPluginInstalled())));
8486
} catch (Throwable ex) {
8587
// Log error but do not crash
8688
log.error("Failed to perform Java upgrade action from context menu", ex);

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/javaupgrade/action/JavaUpgradeQuickFix.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import lombok.extern.slf4j.Slf4j;
1616
import org.jetbrains.annotations.Nls;
1717
import org.jetbrains.annotations.NotNull;
18+
19+
import java.util.Map;
20+
1821
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.utils.Constants.UPGRADE_JAVA_FRAMEWORK_PROMPT;
1922

2023
/**
@@ -53,7 +56,7 @@ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descri
5356
try {
5457
String prompt = buildPromptForIssue(issue);
5558
JavaVersionNotificationService.getInstance().openCopilotChatWithPrompt(project, prompt);
56-
AppModUtils.logTelemetryEvent("openCopilotChatForJavaUpgradeQuickFix");
59+
AppModUtils.logTelemetryEvent("openCopilotChatForJavaUpgradeQuickFix", Map.of("appmodPluginInstalled", String.valueOf(AppModPluginInstaller.isAppModPluginInstalled())));
5760
} catch (Throwable ex) {
5861
log.error("Failed to apply Java upgrade quick fix", ex);
5962
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appmod/src/main/java/com/microsoft/azure/toolkit/intellij/appmod/javaupgrade/service/JavaVersionNotificationService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import static com.microsoft.azure.toolkit.intellij.appmod.javaupgrade.service.JavaUpgradeIssuesDetectionService.*;
2727
import java.lang.reflect.Method;
2828

29+
import com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemeter;
2930
import kotlin.Unit;
3031
import kotlin.jvm.functions.Function1;
3132
import lombok.extern.slf4j.Slf4j;
@@ -402,6 +403,7 @@ private boolean tryReflectionCopilotCall(@Nonnull Project project, @Nonnull Stri
402403
return Unit.INSTANCE;
403404
};
404405
queryMethod.invoke(service, DataContext.EMPTY_CONTEXT, queryBuilder);
406+
AppModUtils.logTelemetryEvent("openCopilotChatForJavaUpgrade", Map.of("javaupgrade.prompt", prompt));
405407
return true;
406408
}
407409
} catch (Exception e) {

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-lib-java/src/main/java/com/microsoft/azure/toolkit/intellij/common/utils/JdkUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static Integer getJdkLanguageLevel(Sdk jdk) {
108108
final String versionStr = matcher.group(0);
109109
try {
110110
return JavaVersion.parse(versionStr).feature;
111-
} catch (IllegalArgumentException e) {
111+
} catch (Exception e) {
112112
// Invalid Java version format (e.g., Python version like "3.12.10")
113113
return null;
114114
}

0 commit comments

Comments
 (0)