Skip to content

Commit

Permalink
fix: process url path to avoid being redacted in mos api telemetry (#…
Browse files Browse the repository at this point in the history
…12423)

* fix: process url path in mos api telemetry

* fix: process url path in mos api telemetry
  • Loading branch information
jayzhang authored Sep 23, 2024
1 parent 3aaafb2 commit 0febdae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/fx-core/src/common/wrappedAxiosClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class WrappedAxiosClient {
* @returns
*/
public static onRejected(error: AxiosError) {
const method = error.request.method;
const method = error.request.method as string;
const fullPath = `${(error.request.host as string) ?? ""}${
(error.request.path as string) ?? ""
}`;
Expand Down Expand Up @@ -135,7 +135,8 @@ export class WrappedAxiosClient {
}: ${innerError.message as string} `;
properties[TelemetryProperty.ErrorMessage] = finalMessage;
properties[TelemetryProperty.MOSTraceId] = tracingId;
properties[TelemetryProperty.MOSPATH] = fullPath;
const relativePath = (error.request.path || "") as string;
properties[TelemetryProperty.MOSPATH] = method + " " + relativePath.replace(/\//g, "__");
}

TOOLS?.telemetryReporter?.sendTelemetryErrorEvent(eventName, properties);
Expand Down

0 comments on commit 0febdae

Please sign in to comment.