mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 11:01:37 -05:00
Add more telemetry for sql database projects (#18751)
* add more telemetry for sql database projects * add publishToContainer events * send target platform when publishing * add duration for createProjectFromDb and updateProjectFromDb
This commit is contained in:
@@ -26,11 +26,17 @@ export enum TelemetryActions {
|
|||||||
deleteObjectFromProject = 'deleteObjectFromProject',
|
deleteObjectFromProject = 'deleteObjectFromProject',
|
||||||
editProjectFile = 'editProjectFile',
|
editProjectFile = 'editProjectFile',
|
||||||
addItemFromTree = 'addItemFromTree',
|
addItemFromTree = 'addItemFromTree',
|
||||||
|
addExistingItem = 'addExistingItem',
|
||||||
excludeFromProject = 'excludeFromProject',
|
excludeFromProject = 'excludeFromProject',
|
||||||
projectSchemaCompareCommandInvoked = 'projectSchemaCompareCommandInvoked',
|
projectSchemaCompareCommandInvoked = 'projectSchemaCompareCommandInvoked',
|
||||||
publishProject = 'publishProject',
|
publishProject = 'publishProject',
|
||||||
build = 'build',
|
build = 'build',
|
||||||
updateProjectForRoundtrip = 'updateProjectForRoundtrip',
|
updateProjectForRoundtrip = 'updateProjectForRoundtrip',
|
||||||
changePlatformType = 'changePlatformType',
|
changePlatformType = 'changePlatformType',
|
||||||
updateSystemDatabaseReferencesInProjFile = 'updateSystemDatabaseReferencesInProjFile'
|
updateSystemDatabaseReferencesInProjFile = 'updateSystemDatabaseReferencesInProjFile',
|
||||||
|
startAddSqlBinding = 'startAddSqlBinding',
|
||||||
|
finishAddSqlBinding = 'finishAddSqlBinding',
|
||||||
|
createProjectFromDatabase = 'createProjectFromDatabase',
|
||||||
|
updateProjectFromDatabase = 'updateProjectFromDatabase',
|
||||||
|
publishToContainer = 'publishToContainer'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,11 @@ export class ProjectsController {
|
|||||||
*/
|
*/
|
||||||
public async createNewProject(creationParams: NewProjectParams): Promise<string> {
|
public async createNewProject(creationParams: NewProjectParams): Promise<string> {
|
||||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectController, TelemetryActions.createNewProject)
|
TelemetryReporter.createActionEvent(TelemetryViews.ProjectController, TelemetryActions.createNewProject)
|
||||||
.withAdditionalProperties({ template: creationParams.projectTypeId, sdkStyle: creationParams.sdkStyle!.toString() })
|
.withAdditionalProperties({
|
||||||
|
template: creationParams.projectTypeId,
|
||||||
|
sdkStyle: creationParams.sdkStyle!.toString(),
|
||||||
|
targetPlatform: creationParams.targetPlatform?.toString() ?? ''
|
||||||
|
})
|
||||||
.send();
|
.send();
|
||||||
|
|
||||||
if (creationParams.projectGuid && !UUID.isUUID(creationParams.projectGuid)) {
|
if (creationParams.projectGuid && !UUID.isUUID(creationParams.projectGuid)) {
|
||||||
@@ -270,6 +274,8 @@ export class ProjectsController {
|
|||||||
public async publishToDockerContainer(context: Project | dataworkspace.WorkspaceTreeItem, deployProfile: IDeployProfile): Promise<void> {
|
public async publishToDockerContainer(context: Project | dataworkspace.WorkspaceTreeItem, deployProfile: IDeployProfile): Promise<void> {
|
||||||
const project: Project = this.getProjectFromContext(context);
|
const project: Project = this.getProjectFromContext(context);
|
||||||
try {
|
try {
|
||||||
|
TelemetryReporter.sendActionEvent(TelemetryViews.ProjectController, TelemetryActions.publishToContainer);
|
||||||
|
|
||||||
if (deployProfile && deployProfile.deploySettings) {
|
if (deployProfile && deployProfile.deploySettings) {
|
||||||
let connectionUri: string | undefined;
|
let connectionUri: string | undefined;
|
||||||
if (deployProfile.localDbSetting) {
|
if (deployProfile.localDbSetting) {
|
||||||
@@ -279,6 +285,7 @@ export class ProjectsController {
|
|||||||
deployProfile.deploySettings.connectionUri = connectionUri;
|
deployProfile.deploySettings.connectionUri = connectionUri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deployProfile.deploySettings.connectionUri) {
|
if (deployProfile.deploySettings.connectionUri) {
|
||||||
const publishResult = await this.publishOrScriptProject(project, deployProfile.deploySettings, true);
|
const publishResult = await this.publishOrScriptProject(project, deployProfile.deploySettings, true);
|
||||||
if (publishResult && publishResult.success) {
|
if (publishResult && publishResult.success) {
|
||||||
@@ -295,6 +302,7 @@ export class ProjectsController {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
void utils.showErrorMessageWithOutputChannel(constants.publishToContainerFailed, error, this._outputChannel);
|
void utils.showErrorMessageWithOutputChannel(constants.publishToContainerFailed, error, this._outputChannel);
|
||||||
|
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectController, TelemetryActions.publishToContainer);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -442,6 +450,8 @@ export class ProjectsController {
|
|||||||
const timeToPublish = actionEndTime - actionStartTime;
|
const timeToPublish = actionEndTime - actionStartTime;
|
||||||
telemetryProps.actionDuration = timeToPublish.toString();
|
telemetryProps.actionDuration = timeToPublish.toString();
|
||||||
telemetryProps.totalDuration = (actionEndTime - buildStartTime).toString();
|
telemetryProps.totalDuration = (actionEndTime - buildStartTime).toString();
|
||||||
|
telemetryProps.sqlcmdVariablesCount = Object.keys(project.sqlCmdVariables).length.toString();
|
||||||
|
telemetryProps.projectTargetPLatform = project.getProjectTargetVersion();
|
||||||
|
|
||||||
const currentPublishIndex = this.publishInfo.findIndex(d => d.startDate === currentPublishTimeInfo);
|
const currentPublishIndex = this.publishInfo.findIndex(d => d.startDate === currentPublishTimeInfo);
|
||||||
this.publishInfo[currentPublishIndex].status = result.success ? Status.success : Status.failed;
|
this.publishInfo[currentPublishIndex].status = result.success ? Status.success : Status.failed;
|
||||||
@@ -669,10 +679,12 @@ export class ProjectsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
TelemetryReporter.sendActionEvent(TelemetryViews.ProjectTree, TelemetryActions.addExistingItem);
|
||||||
await project.addExistingItem(uris[0].fsPath);
|
await project.addExistingItem(uris[0].fsPath);
|
||||||
this.refreshProjectsTree(treeNode);
|
this.refreshProjectsTree(treeNode);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
|
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectTree, TelemetryActions.addExistingItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1282,6 +1294,7 @@ export class ProjectsController {
|
|||||||
|
|
||||||
public async createProjectFromDatabaseCallback(model: ImportDataModel) {
|
public async createProjectFromDatabaseCallback(model: ImportDataModel) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const newProjFolderUri = model.filePath;
|
const newProjFolderUri = model.filePath;
|
||||||
|
|
||||||
const newProjFilePath = await this.createNewProject({
|
const newProjFilePath = await this.createNewProject({
|
||||||
@@ -1295,7 +1308,16 @@ export class ProjectsController {
|
|||||||
this.setFilePath(model);
|
this.setFilePath(model);
|
||||||
|
|
||||||
const project = await Project.openProject(newProjFilePath);
|
const project = await Project.openProject(newProjFilePath);
|
||||||
|
|
||||||
|
const startTime = new Date();
|
||||||
|
|
||||||
await this.createProjectFromDatabaseApiCall(model); // Call ExtractAPI in DacFx Service
|
await this.createProjectFromDatabaseApiCall(model); // Call ExtractAPI in DacFx Service
|
||||||
|
|
||||||
|
const timeToExtract = new Date().getTime() - startTime.getTime();
|
||||||
|
TelemetryReporter.createActionEvent(TelemetryViews.ProjectController, TelemetryActions.createProjectFromDatabase)
|
||||||
|
.withAdditionalMeasurements({ durationMs: timeToExtract })
|
||||||
|
.send();
|
||||||
|
|
||||||
let fileFolderList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateList(model.filePath); // Create a list of all the files and directories to be added to project
|
let fileFolderList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateList(model.filePath); // Create a list of all the files and directories to be added to project
|
||||||
|
|
||||||
if (!model.sdkStyle) {
|
if (!model.sdkStyle) {
|
||||||
@@ -1308,6 +1330,7 @@ export class ProjectsController {
|
|||||||
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
|
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
|
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectController, TelemetryActions.createProjectFromDatabase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1373,9 +1396,17 @@ export class ProjectsController {
|
|||||||
|
|
||||||
public async updateProjectFromDatabaseCallback(model: UpdateProjectDataModel) {
|
public async updateProjectFromDatabaseCallback(model: UpdateProjectDataModel) {
|
||||||
try {
|
try {
|
||||||
|
const startTime = new Date();
|
||||||
|
|
||||||
await this.updateProjectFromDatabaseApiCall(model);
|
await this.updateProjectFromDatabaseApiCall(model);
|
||||||
|
|
||||||
|
const timeToUpdate = new Date().getTime() - startTime.getTime();
|
||||||
|
TelemetryReporter.createActionEvent(TelemetryViews.ProjectController, TelemetryActions.updateProjectFromDatabase)
|
||||||
|
.withAdditionalMeasurements({ durationMs: timeToUpdate })
|
||||||
|
.send();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
|
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectController, TelemetryActions.updateProjectFromDatabase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user