mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Add telemetry to troubleshoot customer issues (#17748)
* Add telemetry to troubleshoot customer issues * Updating logerror method calls with custom errors * Add performance telemetry
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as vscode from 'vscode';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { logError, sendSqlMigrationActionEvent, TelemetryAction, TelemetryViews } from '../telemtery';
|
||||
import { DatabaseMigration, SqlMigrationService, SqlManagedInstance, getMigrationStatus, AzureAsyncOperationResource, getMigrationAsyncOperationDetails, SqlVMServer, getSubscriptions } from '../api/azure';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -19,7 +20,7 @@ export class MigrationLocalStorage {
|
||||
const undefinedSessionId = '{undefined}';
|
||||
const result: MigrationContext[] = [];
|
||||
const validMigrations: MigrationContext[] = [];
|
||||
|
||||
const startTime = new Date().toString();
|
||||
// fetch saved migrations
|
||||
const migrationMementos: MigrationContext[] = this.context.globalState.get(this.mementoToken) || [];
|
||||
for (let i = 0; i < migrationMementos.length; i++) {
|
||||
@@ -53,7 +54,7 @@ export class MigrationLocalStorage {
|
||||
case 'NullMigrationId':
|
||||
continue;
|
||||
default:
|
||||
console.log(e);
|
||||
logError(TelemetryViews.MigrationLocalStorage, 'MigrationBySourceConnectionError', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +63,20 @@ export class MigrationLocalStorage {
|
||||
validMigrations.push(migration);
|
||||
}
|
||||
|
||||
await this.context.globalState.update(this.mementoToken, validMigrations);
|
||||
|
||||
sendSqlMigrationActionEvent(
|
||||
TelemetryViews.MigrationLocalStorage,
|
||||
TelemetryAction.Done,
|
||||
{
|
||||
'startTime': startTime,
|
||||
'endTime': new Date().toString()
|
||||
},
|
||||
{
|
||||
'migrationCount': migrationMementos.length
|
||||
}
|
||||
);
|
||||
|
||||
// only save updated migration context
|
||||
if (refreshStatus) {
|
||||
const migrations: MigrationContext[] = this.context.globalState.get(this.mementoToken) || [];
|
||||
@@ -79,7 +94,6 @@ export class MigrationLocalStorage {
|
||||
await this.context.globalState.update(this.mementoToken, migrations);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -121,7 +135,7 @@ export class MigrationLocalStorage {
|
||||
});
|
||||
await this.context.globalState.update(this.mementoToken, migrationMementos);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
logError(TelemetryViews.MigrationLocalStorage, 'CantSaveMigration', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user