Skip to content

Commit c30f895

Browse files
committed
Add missing telemetries for mysql
1 parent 996a80e commit c30f895

File tree

5 files changed

+32
-1
lines changed

5 files changed

+32
-1
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/link/LinkMySQLToModuleDialog.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
import com.microsoft.azure.toolkit.intellij.link.mysql.MySQLResourceConfig;
1616
import com.microsoft.azure.toolkit.intellij.link.po.MySQLResourcePO;
1717
import com.microsoft.azure.toolkit.lib.common.form.AzureForm;
18+
import com.microsoft.azure.toolkit.lib.common.operation.IAzureOperationTitle;
1819
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1920
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
2021
import com.microsoft.azure.toolkit.lib.link.AzureLinkService;
22+
import com.microsoft.azuretools.ActionConstants;
2123
import com.microsoft.intellij.AzureMySQLStorage;
2224
import com.microsoft.tooling.msservices.components.DefaultLoader;
2325
import com.microsoft.tooling.msservices.serviceexplorer.azure.mysql.MySQLNode;
@@ -100,7 +102,12 @@ private void doLink(LinkConfig<MySQLResourceConfig, ModuleResourceConfig> linkCo
100102
AzureLinkService.getInstance().link(project, linkConfig, finalStorageResource);
101103
};
102104
String progressMessage = "Connecting Azure Database for MySQL with Module...";
103-
final AzureTask task = new AzureTask(null, progressMessage, false, runnable);
105+
final AzureTask task = new AzureTask(null, new IAzureOperationTitle.Simple(progressMessage) {
106+
@Override
107+
public String getName() {
108+
return ActionConstants.MySQL.LINK_TO_MODULE;
109+
}
110+
}, false, runnable);
104111
AzureTaskManager.getInstance().runInBackground(task);
105112
}
106113

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/mysql/MySQLPropertyView.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException;
1515
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1616
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
17+
import com.microsoft.azuretools.ActionConstants;
1718
import com.microsoft.azuretools.azurecommons.util.Utils;
1819
import com.microsoft.azuretools.core.mvp.model.AzureMvpModel;
1920
import com.microsoft.azuretools.core.mvp.model.mysql.MySQLMvpModel;
2021
import com.microsoft.azure.toolkit.intellij.common.BaseEditor;
22+
import com.microsoft.azuretools.telemetry.TelemetryConstants;
23+
import com.microsoft.azuretools.telemetrywrapper.EventType;
24+
import com.microsoft.azuretools.telemetrywrapper.EventUtil;
2125
import com.microsoft.tooling.msservices.serviceexplorer.Node;
2226
import com.microsoft.tooling.msservices.serviceexplorer.azure.mysql.MySQLModule;
2327
import com.microsoft.tooling.msservices.serviceexplorer.azure.mysql.MySQLProperty;
@@ -28,7 +32,9 @@
2832
import javax.swing.*;
2933
import java.awt.event.ActionEvent;
3034
import java.awt.event.ItemEvent;
35+
import java.util.HashMap;
3136
import java.util.List;
37+
import java.util.Map;
3238

3339
public class MySQLPropertyView extends BaseEditor implements MySQLPropertyMvpView {
3440

@@ -155,6 +161,12 @@ private void onSaveButtonClicked(ActionEvent e) {
155161
Boolean changed = MySQLPropertyView.this.changed();
156162
MySQLPropertyView.this.propertyActionPanel.getSaveButton().setEnabled(changed);
157163
MySQLPropertyView.this.propertyActionPanel.getDiscardButton().setEnabled(changed);
164+
final Map<String, String> properties = new HashMap<>();
165+
properties.put(TelemetryConstants.SUBSCRIPTIONID, subscriptionId);
166+
properties.put("allowAccessToLocal", String.valueOf(allowAccessToLocal));
167+
properties.put("allowAccessToAzureServices", String.valueOf(allowAccessToAzureServices));
168+
EventUtil.logEvent(EventType.info, ActionConstants.parse(ActionConstants.MySQL.SAVE).getServiceName(),
169+
ActionConstants.parse(ActionConstants.MySQL.SAVE).getOperationName(), properties);
158170
};
159171
AzureTaskManager.getInstance().runInBackground(new AzureTask(null, String.format("%s...", actionName), false, runnable));
160172
}

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/mysql/action/MySQLConnectToServerAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import com.intellij.openapi.extensions.PluginId;
1010
import com.intellij.openapi.project.Project;
1111
import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException;
12+
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation;
13+
import com.microsoft.azuretools.ActionConstants;
1214
import com.microsoft.azuretools.authmanage.AuthMethodManager;
1315
import com.microsoft.intellij.actions.AzureSignInAction;
1416
import com.microsoft.intellij.AzurePlugin;
@@ -61,6 +63,7 @@ public void actionPerformed(NodeActionEvent e) {
6163
});
6264
}
6365

66+
@AzureOperation(name = ActionConstants.MySQL.CONNECT_TO_SERVER, type = AzureOperation.Type.ACTION)
6467
private void doActionPerformed(NodeActionEvent e, boolean isLoggedIn, Project project) {
6568
try {
6669
if (!isLoggedIn ||

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/LinkAzureServiceBeforeRunProvider.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
import com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager;
2424
import com.microsoft.azure.toolkit.intellij.webapp.runner.webappconfig.WebAppConfiguration;
2525
import com.microsoft.azure.toolkit.lib.link.AzureLinkService;
26+
import com.microsoft.azuretools.ActionConstants;
27+
import com.microsoft.azuretools.telemetry.TelemetryConstants;
28+
import com.microsoft.azuretools.telemetrywrapper.EventType;
29+
import com.microsoft.azuretools.telemetrywrapper.EventUtil;
2630
import com.microsoft.intellij.actions.SelectSubscriptionsAction;
2731
import com.microsoft.intellij.helpers.AzureIconLoader;
2832
import com.microsoft.tooling.msservices.serviceexplorer.AzureIconSymbol;
@@ -32,6 +36,7 @@
3236
import org.jetbrains.annotations.Nullable;
3337

3438
import javax.swing.*;
39+
import java.util.Collections;
3540
import java.util.Map;
3641
import java.util.Objects;
3742

@@ -86,6 +91,8 @@ public boolean executeTask(@NotNull DataContext dataContext, @NotNull RunConfigu
8691
}
8792
Map<String, String> linkedEnvMap = AzureLinkService.getInstance().retrieveLinkEnvsByModuleName(runConfiguration.getProject(), moduleName);
8893
if (MapUtils.isNotEmpty(linkedEnvMap)) {
94+
EventUtil.logEvent(EventType.info, ActionConstants.parse(ActionConstants.MySQL.DO_SERVICE_LINK).getServiceName(),
95+
ActionConstants.parse(ActionConstants.MySQL.DO_SERVICE_LINK).getOperationName(), null);
8996
// set envs for remote deploy
9097
if (runConfiguration instanceof WebAppConfiguration) {
9198
WebAppConfiguration webAppConfiguration = (WebAppConfiguration) runConfiguration;

Utils/azuretools-core/src/com/microsoft/azuretools/ActionConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ public interface MySQL {
9696
String START = OPERATION_PREFIX + "start";
9797
String STOP = OPERATION_PREFIX + "stop";
9898
String RESTART = OPERATION_PREFIX + "restart";
99+
String SAVE = OPERATION_PREFIX + "save";
99100
String OPEN_IN_PORTAL = OPERATION_PREFIX + "open-in-portal";
100101
String SHOW_PROPERTIES = OPERATION_PREFIX + "show-properties";
101102
String CONNECT_TO_SERVER = OPERATION_PREFIX + "connect-to-server";
102103
String BIND_INTO = OPERATION_PREFIX + "bind-into";
103104
String LINK_TO_MODULE = OPERATION_PREFIX + "link-to-module";
105+
String DO_SERVICE_LINK = OPERATION_PREFIX + "do-link";
104106
}
105107

106108
public interface SpringCloud {

0 commit comments

Comments
 (0)