From f4ef35a8ccb39d0ebd66b8fe695efc19008172ad Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 19 Jan 2023 17:15:23 +0100 Subject: [PATCH 1/2] fix(otel): use http/grpc status over span status --- .../src/utils/map-otel-status.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/opentelemetry-node/src/utils/map-otel-status.ts b/packages/opentelemetry-node/src/utils/map-otel-status.ts index 789cd7706622..b3f8b085fb2c 100644 --- a/packages/opentelemetry-node/src/utils/map-otel-status.ts +++ b/packages/opentelemetry-node/src/utils/map-otel-status.ts @@ -46,16 +46,6 @@ const canonicalCodesGrpcMap: Record = { export function mapOtelStatus(otelSpan: OtelSpan): SentryStatus { const { status, attributes } = otelSpan; - const statusCode = status.code; - - if (statusCode < 0 || statusCode > 2) { - return 'unknown_error'; - } - - if (statusCode === 0 || statusCode === 1) { - return 'ok'; - } - const httpCode = attributes[SemanticAttributes.HTTP_STATUS_CODE]; const grpcCode = attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE]; @@ -74,5 +64,15 @@ export function mapOtelStatus(otelSpan: OtelSpan): SentryStatus { } } + const statusCode = status.code; + + if (statusCode < 0 || statusCode > 2) { + return 'unknown_error'; + } + + if (statusCode === 0 || statusCode === 1) { + return 'ok'; + } + return 'unknown_error'; } From 35ed89e357679f168a52229277f92836653c7244 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 19 Jan 2023 19:14:59 +0100 Subject: [PATCH 2/2] kill the branch --- packages/opentelemetry-node/src/utils/map-otel-status.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/opentelemetry-node/src/utils/map-otel-status.ts b/packages/opentelemetry-node/src/utils/map-otel-status.ts index b3f8b085fb2c..968150852e6e 100644 --- a/packages/opentelemetry-node/src/utils/map-otel-status.ts +++ b/packages/opentelemetry-node/src/utils/map-otel-status.ts @@ -65,11 +65,6 @@ export function mapOtelStatus(otelSpan: OtelSpan): SentryStatus { } const statusCode = status.code; - - if (statusCode < 0 || statusCode > 2) { - return 'unknown_error'; - } - if (statusCode === 0 || statusCode === 1) { return 'ok'; }