Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(otel): use http/grpc status over span status #6879

Merged
merged 2 commits into from Jan 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/opentelemetry-node/src/utils/map-otel-status.ts
Expand Up @@ -46,16 +46,6 @@ const canonicalCodesGrpcMap: Record<string, SentryStatus> = {
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];

Expand All @@ -74,5 +64,15 @@ export function mapOtelStatus(otelSpan: OtelSpan): SentryStatus {
}
}

const statusCode = status.code;

if (statusCode < 0 || statusCode > 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can kill this branch :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:o

return 'unknown_error';
}

if (statusCode === 0 || statusCode === 1) {
return 'ok';
}

return 'unknown_error';
}