|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | | -import { AuthError } from '@azure/msal-node'; |
| 6 | +import { AuthError, ClientAuthError } from '@azure/msal-node'; |
7 | 7 | import TelemetryReporter, { TelemetryEventProperties } from '@vscode/extension-telemetry'; |
8 | 8 | import { IExperimentationTelemetry } from 'vscode-tas-client'; |
9 | 9 |
|
@@ -108,6 +108,40 @@ export class MicrosoftAuthenticationTelemetryReporter implements IExperimentatio |
108 | 108 | }); |
109 | 109 | } |
110 | 110 |
|
| 111 | + sendTelemetryClientAuthErrorEvent(error: ClientAuthError): void { |
| 112 | + const errorCode = error.errorCode; |
| 113 | + const correlationId = error.correlationId; |
| 114 | + let brokerErrorCode: string | undefined; |
| 115 | + let brokerStatusCode: string | undefined; |
| 116 | + let brokerTag: string | undefined; |
| 117 | + |
| 118 | + // Extract platform broker error information if available |
| 119 | + if (error.platformBrokerError) { |
| 120 | + brokerErrorCode = error.platformBrokerError.errorCode; |
| 121 | + brokerStatusCode = `${error.platformBrokerError.statusCode}`; |
| 122 | + brokerTag = error.platformBrokerError.tag; |
| 123 | + } |
| 124 | + |
| 125 | + /* __GDPR__ |
| 126 | + "msalClientAuthError" : { |
| 127 | + "owner": "TylerLeonhardt", |
| 128 | + "comment": "Used to determine how often users run into client auth errors during the login flow.", |
| 129 | + "errorCode": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The client auth error code." }, |
| 130 | + "correlationId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The client auth error correlation id." }, |
| 131 | + "brokerErrorCode": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The broker error code." }, |
| 132 | + "brokerStatusCode": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The broker error status code." }, |
| 133 | + "brokerTag": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The broker error tag." } |
| 134 | + } |
| 135 | + */ |
| 136 | + this._telemetryReporter.sendTelemetryErrorEvent('msalClientAuthError', { |
| 137 | + errorCode, |
| 138 | + correlationId, |
| 139 | + brokerErrorCode, |
| 140 | + brokerStatusCode, |
| 141 | + brokerTag |
| 142 | + }); |
| 143 | + } |
| 144 | + |
111 | 145 | /** |
112 | 146 | * Sends an event for an account type available at startup. |
113 | 147 | * @param scopes The scopes for the session |
|
0 commit comments