@microsoft/ads-extension-telemetry
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -138,3 +138,6 @@ import { TimedAction } from './timedAction'; | ||
sendTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasures): void; | ||
dispose(): Promise<any>; | ||
/** | ||
* Disposes of the telemetry reporter. This flushes the remaining events and disposes of the telemetry client. | ||
*/ | ||
dispose(): Promise<void>; | ||
} |
@@ -5,2 +5,11 @@ "use strict"; | ||
*--------------------------------------------------------*/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -67,4 +76,5 @@ const extension_telemetry_1 = require("@vscode/extension-telemetry"); | ||
send() { | ||
var _a; | ||
try { | ||
this.reporter.sendTelemetryEvent(this.eventName, this.properties, this.measurements); | ||
(_a = this.reporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(this.eventName, this.properties, this.measurements); | ||
} | ||
@@ -103,3 +113,11 @@ catch (e) { | ||
constructor(extensionId, extensionVersion, key) { | ||
this._telemetryReporter = new extension_telemetry_1.default(extensionId, extensionVersion, key); | ||
var _a, _b; | ||
this._telemetryReporter = undefined; | ||
// Try to initialize the reporter, but don't throw if it fails so we don't break the extension | ||
try { | ||
this._telemetryReporter = new extension_telemetry_1.default(extensionId, extensionVersion, key); | ||
} | ||
catch (e) { | ||
console.error(`Error initializing TelemetryReporter for '${extensionId}'. ${(_b = (_a = e) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : e}`); | ||
} | ||
} | ||
@@ -223,4 +241,10 @@ /** | ||
} | ||
/** | ||
* Disposes of the telemetry reporter. This flushes the remaining events and disposes of the telemetry client. | ||
*/ | ||
dispose() { | ||
return this._telemetryReporter.dispose(); | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield ((_a = this._telemetryReporter) === null || _a === void 0 ? void 0 : _a.dispose()); | ||
}); | ||
} | ||
@@ -227,0 +251,0 @@ } |
{ | ||
"name": "@microsoft/ads-extension-telemetry", | ||
"description": "A module for first party Microsoft extensions to report consistent telemetry.", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"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
33368
492