@microsoft/vscode-azext-utils
Advanced tools
Comparing version
@@ -34,6 +34,12 @@ "use strict"; | ||
wizardContext.resourceGroup = pickedAzureResource.resource.resourceGroup; | ||
wizardContext.resourceId = pickedAzureResource.resource.id; | ||
wizardContext.subscriptionId = pickedAzureResource.resource.subscription.subscriptionId; | ||
wizardContext.telemetry.properties.subscriptionId = pickedAzureResource.resource.subscription.subscriptionId; | ||
wizardContext.telemetry.properties.resourceId = pickedAzureResource.resource.id; | ||
try { | ||
// it's possible that if subscription is not set on AzExtTreeItems, an error is thrown | ||
// see https://github.com/microsoft/vscode-azuretools/blob/cc1feb3a819dd503eb59ebcc1a70051d4e9a3432/utils/src/tree/AzExtTreeItem.ts#L154 | ||
wizardContext.telemetry.properties.subscriptionId = pickedAzureResource.resource.subscription.subscriptionId; | ||
wizardContext.telemetry.properties.resourceId = pickedAzureResource.resource.id; | ||
} | ||
catch (e) { | ||
// we don't want to block execution just because we can't set the telemetry property | ||
// see https://github.com/microsoft/vscode-azureresourcegroups/issues/1081 | ||
} | ||
return pickedAzureResource; | ||
@@ -40,0 +46,0 @@ }); |
@@ -35,3 +35,11 @@ "use strict"; | ||
wizardContext.subscription = pickedSubscription.subscription; | ||
wizardContext.telemetry.properties.subscriptionId = pickedSubscription.subscription.subscriptionId; | ||
try { | ||
// it's possible that if subscription is not set on AzExtTreeItems, an error is thrown | ||
// see https://github.com/microsoft/vscode-azuretools/blob/cc1feb3a819dd503eb59ebcc1a70051d4e9a3432/utils/src/tree/AzExtTreeItem.ts#L154 | ||
wizardContext.telemetry.properties.subscriptionId = pickedSubscription.subscription.subscriptionId; | ||
} | ||
catch (e) { | ||
// we don't want to block execution just because we can't set the telemetry property | ||
// see https://github.com/microsoft/vscode-azureresourcegroups/issues/1081 | ||
} | ||
return pickedSubscription; | ||
@@ -38,0 +46,0 @@ }); |
@@ -23,2 +23,3 @@ "use strict"; | ||
const vscode_azureresources_api_1 = require("@microsoft/vscode-azureresources-api"); | ||
const parseError_1 = require("./parseError"); | ||
function isTreeElementBase(object) { | ||
@@ -42,3 +43,11 @@ return typeof object === 'object' && object !== null && 'getTreeItem' in object; | ||
if (args.length > 0) { | ||
yield setTelemetryProperties(context, args); | ||
try { | ||
yield setTelemetryProperties(context, args); | ||
} | ||
catch (e) { | ||
const error = (0, parseError_1.parseError)(e); | ||
// if we fail to set telemetry properties, we don't want to throw an error and prevent the command from executing | ||
extensionVariables_1.ext.outputChannel.appendLine(`registerCommand: Failed to set telemetry properties: ${e}`); | ||
context.telemetry.properties.telemetryError = error.message; | ||
} | ||
} | ||
@@ -77,4 +86,12 @@ return callback(context, ...args); | ||
if (arg instanceof AzExtTreeItem_1.AzExtTreeItem) { | ||
context.telemetry.properties.resourceId = arg.id; | ||
context.telemetry.properties.subscriptionId = arg.subscription.subscriptionId; | ||
try { | ||
context.telemetry.properties.resourceId = arg.id; | ||
// it's possible that if subscription is not set on AzExtTreeItems, an error is thrown | ||
// see https://github.com/microsoft/vscode-azuretools/blob/cc1feb3a819dd503eb59ebcc1a70051d4e9a3432/utils/src/tree/AzExtTreeItem.ts#L154 | ||
context.telemetry.properties.subscriptionId = arg.subscription.subscriptionId; | ||
} | ||
catch (e) { | ||
// we don't want to block execution of the command just because we can't set the telemetry properties | ||
// see https://github.com/microsoft/vscode-azureresourcegroups/issues/1080 | ||
} | ||
(0, addTreeItemValuesToMask_1.addTreeItemValuesToMask)(context, arg, 'command'); | ||
@@ -81,0 +98,0 @@ } |
{ | ||
"name": "@microsoft/vscode-azext-utils", | ||
"author": "Microsoft Corporation", | ||
"version": "2.6.2", | ||
"version": "2.6.3", | ||
"description": "Common UI tools for developing Azure extensions for VS Code", | ||
@@ -6,0 +6,0 @@ "tags": [ |
446743
0.45%8665
0.36%