From 79cf938a69c60aea2b9b35c17c74bdfe411950cd Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Wed, 13 Jan 2021 14:16:54 -0800 Subject: [PATCH] OpenTelemetry exporter use correct error code when there is a network issue (#13205) * Adding correct error code when there is an issue in core-http * Initial commit --- .../src/export/trace.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sdk/monitor/opentelemetry-exporter-azure-monitor/src/export/trace.ts b/sdk/monitor/opentelemetry-exporter-azure-monitor/src/export/trace.ts index ef6dbe6b9937..3815ce8f9835 100644 --- a/sdk/monitor/opentelemetry-exporter-azure-monitor/src/export/trace.ts +++ b/sdk/monitor/opentelemetry-exporter-azure-monitor/src/export/trace.ts @@ -158,15 +158,7 @@ export class AzureMonitorTraceExporter implements SpanExporter { private _isNetworkError(error: Error): boolean { if (error instanceof RestError) { - if ( - error && - error.code && - (error.code === "ETIMEDOUT" || - error.code === "ESOCKETTIMEDOUT" || - error.code === "ECONNREFUSED" || - error.code === "ECONNRESET" || - error.code === "ENOENT") - ) { + if (error && error.code && error.code === "REQUEST_SEND_ERROR") { return true; } }