office-addin-usage-data
Advanced tools
Comparing version
export declare const usageDataJsonFilePath: string; | ||
export declare const groupName = "office-addin-usage-data"; | ||
export declare const instrumentationKeyForOfficeAddinCLITools = "de0d9e7c-1f46-4552-bc21-4e43e489a015"; |
@@ -8,2 +8,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
exports.groupName = "office-addin-usage-data"; | ||
exports.instrumentationKeyForOfficeAddinCLITools = "de0d9e7c-1f46-4552-bc21-4e43e489a015"; | ||
//# sourceMappingURL=defaults.js.map |
@@ -93,3 +93,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
const usageDataEvent = new appInsights.Contracts.EventData(); | ||
usageDataEvent.name = eventName; | ||
usageDataEvent.name = this.options.isForTesting ? `${eventName}-test` : eventName; | ||
try { | ||
@@ -100,5 +100,3 @@ for (const [key, [value, elapsedTime]] of Object.entries(data)) { | ||
} | ||
if (!this.options.isForTesting) { | ||
this.usageDataClient.trackEvent(usageDataEvent); | ||
} | ||
this.usageDataClient.trackEvent(usageDataEvent); | ||
this.eventsSent++; | ||
@@ -133,6 +131,4 @@ } | ||
if (this.getUsageDataLevel() === UsageDataLevel.on) { | ||
err.name = errorName; | ||
if (!this.options.isForTesting) { | ||
this.usageDataClient.trackException({ exception: this.maskFilePaths(err) }); | ||
} | ||
err.name = this.options.isForTesting ? `${errorName}-test` : errorName; | ||
this.usageDataClient.trackException({ exception: this.maskFilePaths(err) }); | ||
this.exceptionsSent++; | ||
@@ -139,0 +135,0 @@ } |
{ | ||
"name": "office-addin-usage-data", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "Provides infrastructure to send usage data events and exceptions.", | ||
@@ -46,3 +46,3 @@ "main": "./lib/main.js", | ||
}, | ||
"gitHead": "f2bc0faaa87340892ad49cce491299507998aa25" | ||
"gitHead": "26ea393eabd36d75f62a736ba53b460eaa99e73c" | ||
} |
@@ -9,1 +9,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
export const groupName = "office-addin-usage-data"; | ||
export const instrumentationKeyForOfficeAddinCLITools = "de0d9e7c-1f46-4552-bc21-4e43e489a015"; |
@@ -111,11 +111,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
const usageDataEvent = new appInsights.Contracts.EventData(); | ||
usageDataEvent.name = eventName; | ||
usageDataEvent.name = this.options.isForTesting ? `${eventName}-test` : eventName; | ||
try { | ||
for (const [key, [value, elapsedTime]] of Object.entries(data)) { | ||
usageDataEvent.properties[key] = value; | ||
usageDataEvent.properties[key] = value; | ||
usageDataEvent.measurements[key + " durationElapsed"] = elapsedTime; | ||
} | ||
if (!this.options.isForTesting) { | ||
this.usageDataClient.trackEvent(usageDataEvent); | ||
} | ||
this.usageDataClient.trackEvent(usageDataEvent); | ||
this.eventsSent++; | ||
@@ -147,8 +146,6 @@ } catch (err) { | ||
if (this.getUsageDataLevel() === UsageDataLevel.on) { | ||
err.name = errorName; | ||
if (!this.options.isForTesting) { | ||
err.name = this.options.isForTesting ? `${errorName}-test` : errorName; | ||
this.usageDataClient.trackException({ exception: this.maskFilePaths(err) }); | ||
this.exceptionsSent++; | ||
} | ||
this.exceptionsSent++; | ||
} | ||
} | ||
@@ -155,0 +152,0 @@ /** |
@@ -19,3 +19,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
projectName: "Test-Project", | ||
instrumentationKey: "de0d9e7c-1f46-4552-bc21-4e43e489a015", | ||
instrumentationKey: defaults.instrumentationKeyForOfficeAddinCLITools, | ||
promptQuestion: "-----------------------------------------\nDo you want to opt-in for usage data?[y/n]\n-----------------------------------------", | ||
@@ -151,6 +151,6 @@ raisePrompt: false, | ||
const compareError = new Error(); | ||
compareError.name = "TestData"; | ||
compareError.name = "TestData-test"; | ||
compareError.message = "this error contains a file path:C:index.js"; | ||
// may throw error if change any part of the top of the test file | ||
compareError.stack = "TestData: this error contains a file path:C:index.js"; | ||
compareError.stack = "this error contains a file path:C:index.js"; | ||
addInUsageData.maskFilePaths(err); | ||
@@ -157,0 +157,0 @@ assert.equal(compareError.name, err.name); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74393
0.44%1380
-0.36%