Skip to content

Commit

Permalink
utils & azure: Add new error telemetry properties (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroFish91 authored Aug 27, 2024
1 parent d3c4079 commit 500dfd6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 13 additions & 2 deletions azure/src/wizard/VerifyProvidersStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import type { Provider, ResourceManagementClient } from '@azure/arm-resources';
import { AzureWizardExecuteStep, ISubscriptionActionContext, parseError } from '@microsoft/vscode-azext-utils';
import { AzureWizardExecuteStep, IParsedError, ISubscriptionActionContext, parseError } from '@microsoft/vscode-azext-utils';
import { l10n, Progress } from 'vscode';
import * as types from '../../index';
import { createResourcesClient } from '../clients';
Expand Down Expand Up @@ -39,7 +39,18 @@ export class VerifyProvidersStep<T extends ISubscriptionActionContext> extends A
}
} catch (error) {
// ignore and continue with wizard. An error here would likely be confusing and un-actionable
context.telemetry.properties.providerError = parseError(error).message;
const perror: IParsedError = parseError(error);

/**
* @param providerError
* @deprecated
* Continue to emit telemetry for clients who are still using this property. You should suppress this property if you need to migrate to the new replacement.
*
* @param providerErrorV2
* A duplicate replacement of the `providerError` telemetry property.
*/
context.telemetry.properties.providerError = perror.message;
context.telemetry.properties.providerErrorV2 = perror.message;
}
}));
}
Expand Down
11 changes: 11 additions & 0 deletions utils/src/callWithTelemetryAndErrorHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,18 @@ function handleError(context: types.IActionContext, callbackId: string, error: u
} else {
context.telemetry.properties.result = 'Failed';
context.telemetry.properties.error = errorData.errorType;

/**
* @param errorMessage
* @deprecated
* Continue to emit telemetry for clients who are still using this property. You should suppress this property if you need to migrate to the new replacement.
*
* @param errorMessageV2
* A duplicate replacement of the `errorMessage` telemetry property which should be used instead.
*/
context.telemetry.properties.errorMessage = errorData.message;
context.telemetry.properties.errorMessageV2 = errorData.message;

context.telemetry.properties.stack = errorData.stack ? limitLines(errorData.stack, maxStackLines) : undefined;
if (context.telemetry.suppressIfSuccessful || context.telemetry.suppressAll) {
context.telemetry.properties.suppressTelemetry = 'true';
Expand Down

0 comments on commit 500dfd6

Please sign in to comment.