@microsoft/ads-extension-telemetry
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -0,1 +1,2 @@ | ||
import { TimedAction } from './timedAction'; | ||
/** | ||
@@ -46,4 +47,10 @@ * Holds additional properties to send along with an event. | ||
} | ||
export default class TelemetryReporter { | ||
export declare class TelemetryReporter<V extends string = string, A extends string = string> { | ||
private _telemetryReporter; | ||
/** | ||
* | ||
* @param extensionId The ID of the extension sending the event | ||
* @param extensionVersion The version of the extension sending the event | ||
* @param key The AI Key to use | ||
*/ | ||
constructor(extensionId: string, extensionVersion: string, key: string); | ||
@@ -54,3 +61,3 @@ /** | ||
*/ | ||
createViewEvent(view: string): TelemetryEvent; | ||
createViewEvent(view: V): TelemetryEvent; | ||
/** | ||
@@ -60,3 +67,3 @@ * Sends a View event. This is used to log that a particular page or item was seen. | ||
*/ | ||
sendViewEvent(view: string): void; | ||
sendViewEvent(view: V): void; | ||
/** | ||
@@ -68,4 +75,5 @@ * Creates an Action event that can be sent later. This is used to log when an action was taken, such as clicking a button. | ||
* @param source The source of the action | ||
* @param durationInMs The duration the action took to execute | ||
*/ | ||
createActionEvent(view: string, action: string, target?: string, source?: string, durationInMs?: number): TelemetryEvent; | ||
createActionEvent(view: V, action: A, target?: string, source?: string, durationInMs?: number): TelemetryEvent; | ||
/** | ||
@@ -77,14 +85,27 @@ * Sends a Action event. This is used to log when an action was taken, such as clicking a button. | ||
* @param source The source of the action | ||
* @param durationInMs The duration the action took to execute | ||
*/ | ||
sendActionEvent(view: string, action: string, target?: string, source?: string, durationInMs?: number): void; | ||
sendActionEvent(view: V, action: A, target?: string, source?: string, durationInMs?: number): void; | ||
/** | ||
* Creates a TimedAction - which will create and send an action event with a duration when send() is called. The timer | ||
* starts on construction and ends when send() is called. | ||
* @param view The view this action originates from | ||
* @param action The name of the action | ||
* @param target The name of the item being acted on | ||
* @param source The source of the action | ||
* @returns The TimedAction object | ||
*/ | ||
createTimedAction(view: V, action: A, target?: string, source?: string): TimedAction; | ||
/** | ||
* Creates a Metrics event that can be sent later. This is used to log measurements taken. | ||
* @param metrics The metrics to send | ||
* @param measurements The metrics to send | ||
* @param groupName The name of the group these measurements belong to | ||
*/ | ||
createMetricsEvent(metrics: TelemetryEventMeasures, groupName?: string): TelemetryEvent; | ||
createMetricsEvent(measurements: TelemetryEventMeasures, groupName?: string): TelemetryEvent; | ||
/** | ||
* Sends a Metrics event. This is used to log measurements taken. | ||
* @param measurements The metrics to send | ||
* @param measurements The measurements to send | ||
* @param groupName The name of the group these measurements belong to | ||
*/ | ||
sendMetricsEvent(metrics: TelemetryEventMeasures, groupName?: string): void; | ||
sendMetricsEvent(measurements: TelemetryEventMeasures, groupName?: string): void; | ||
/** | ||
@@ -96,5 +117,4 @@ * Creates a new Error event that can be sent later. This is used to log errors that occur. | ||
* @param errorType The specific type of error | ||
* @param properties Optional additional properties | ||
*/ | ||
createErrorEvent(view: string, name: string, errorCode?: string, errorType?: string): TelemetryEvent; | ||
createErrorEvent(view: V, name: string, errorCode?: string, errorType?: string): TelemetryEvent; | ||
/** | ||
@@ -107,3 +127,3 @@ * Sends a Error event. This is used to log errors that occur. | ||
*/ | ||
sendErrorEvent(view: string, name: string, errorCode?: string, errorType?: string): void; | ||
sendErrorEvent(view: V, name: string, errorCode?: string, errorType?: string): void; | ||
/** | ||
@@ -110,0 +130,0 @@ * Creates a custom telemetry event with the specified name that can be sent later. Generally the other send functions should be |
@@ -0,7 +1,9 @@ | ||
"use strict"; | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TelemetryReporter = void 0; | ||
const extension_telemetry_1 = require("@vscode/extension-telemetry"); | ||
const timedAction_1 = require("./timedAction"); | ||
const commonProperties = {}; | ||
@@ -54,2 +56,8 @@ try { | ||
class TelemetryReporter { | ||
/** | ||
* | ||
* @param extensionId The ID of the extension sending the event | ||
* @param extensionVersion The version of the extension sending the event | ||
* @param key The AI Key to use | ||
*/ | ||
constructor(extensionId, extensionVersion, key) { | ||
@@ -80,2 +88,3 @@ this._telemetryReporter = new extension_telemetry_1.default(extensionId, extensionVersion, key); | ||
* @param source The source of the action | ||
* @param durationInMs The duration the action took to execute | ||
*/ | ||
@@ -97,2 +106,3 @@ createActionEvent(view, action, target = '', source = '', durationInMs) { | ||
* @param source The source of the action | ||
* @param durationInMs The duration the action took to execute | ||
*/ | ||
@@ -103,14 +113,28 @@ sendActionEvent(view, action, target = '', source = '', durationInMs) { | ||
/** | ||
* Creates a TimedAction - which will create and send an action event with a duration when send() is called. The timer | ||
* starts on construction and ends when send() is called. | ||
* @param view The view this action originates from | ||
* @param action The name of the action | ||
* @param target The name of the item being acted on | ||
* @param source The source of the action | ||
* @returns The TimedAction object | ||
*/ | ||
createTimedAction(view, action, target, source) { | ||
return new timedAction_1.TimedAction(this, view, action, target, source); | ||
} | ||
/** | ||
* Creates a Metrics event that can be sent later. This is used to log measurements taken. | ||
* @param metrics The metrics to send | ||
* @param measurements The metrics to send | ||
* @param groupName The name of the group these measurements belong to | ||
*/ | ||
createMetricsEvent(metrics, groupName = '') { | ||
return new TelemetryEventImpl(this._telemetryReporter, 'metrics', { groupName: groupName }, metrics); | ||
createMetricsEvent(measurements, groupName = '') { | ||
return new TelemetryEventImpl(this._telemetryReporter, 'metrics', { groupName: groupName }, measurements); | ||
} | ||
/** | ||
* Sends a Metrics event. This is used to log measurements taken. | ||
* @param measurements The metrics to send | ||
* @param measurements The measurements to send | ||
* @param groupName The name of the group these measurements belong to | ||
*/ | ||
sendMetricsEvent(metrics, groupName = '') { | ||
this.createMetricsEvent(metrics, groupName).send(); | ||
sendMetricsEvent(measurements, groupName = '') { | ||
this.createMetricsEvent(measurements, groupName).send(); | ||
} | ||
@@ -123,3 +147,2 @@ /** | ||
* @param errorType The specific type of error | ||
* @param properties Optional additional properties | ||
*/ | ||
@@ -168,3 +191,3 @@ createErrorEvent(view, name, errorCode = '', errorType = '') { | ||
} | ||
exports.default = TelemetryReporter; | ||
exports.TelemetryReporter = TelemetryReporter; | ||
//# sourceMappingURL=telemetryReporter.js.map |
{ | ||
"name": "@microsoft/ads-extension-telemetry", | ||
"description": "A module for first party Microsoft extensions to report consistent telemetry.", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Microsoft Corporation" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29976
12
427