Files
azuredatastudio/extensions/query-history/src/telemetry.ts
Charles Gagnon 60c1c8a89f Update ads-extension-telemetry to 1.3.1 (#20724)
* Update ads-extension-telemetry to 1.3.0

* fix
2022-10-04 23:06:53 -07:00

46 lines
1.6 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import AdsTelemetryReporter from '@microsoft/ads-extension-telemetry';
export interface PackageInfo {
name: string;
version: string;
aiKey: string;
}
const packageInfo = require('../package.json') as PackageInfo;
export const TelemetryReporter = new AdsTelemetryReporter<TelemetryViews, TelemetryActions>(packageInfo.name, packageInfo.version, packageInfo.aiKey);
/**
* Send an event indicating that a setting changed along with the new and old values. Core has a setting changed
* event already, but that doesn't capture the values so we make our own here.
* @param setting The name of the setting
* @param oldValue The original value
* @param newValue The new value
*/
export function sendSettingChangedEvent(setting: string, oldValue: string, newValue: string): void {
TelemetryReporter.createActionEvent(TelemetryViews.QueryHistoryProvider, TelemetryActions.SettingChanged, setting)
.withAdditionalProperties({
oldValue,
newValue
})
.send();
}
export enum TelemetryViews {
QueryHistory = 'QueryHistory',
QueryHistoryProvider = 'QueryHistoryProvider'
}
export enum TelemetryActions {
DoubleClick = 'DoubleClick',
Initialize = 'Initialize',
ReadStorageFile = 'ReadStorageFile',
SettingChanged = 'SettingChanged',
WriteStorageFile = 'WriteStorageFile'
}