Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d6d262e

Browse files
committed
leave otel status mapping as-is, default to internal_error in http status
1 parent 7de6915 commit d6d262e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

‎packages/core/src/tracing/spanstatus.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function getSpanStatusFromHttpCode(httpStatus: number): SpanStatus {
5151
}
5252
}
5353

54-
return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
54+
return { code: SPAN_STATUS_ERROR, message: 'internal_error' };
5555
}
5656

5757
/**

‎packages/core/test/lib/tracing/spanstatus.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ describe('setHttpStatus', () => {
2727
expect(data).toMatchObject({ 'http.response.status_code': code });
2828
});
2929

30-
it("doesn't set the status for an unknown http status code", () => {
30+
it('defaults to internal_error', () => {
3131
const span = new SentrySpan({ name: 'test' });
3232

3333
setHttpStatus(span, 600);
3434

3535
const { status: spanStatus, data } = spanToJSON(span);
3636

37-
expect(spanStatus).toBeUndefined();
37+
expect(spanStatus).toBe('internal_error');
3838
expect(data).toMatchObject({ 'http.response.status_code': 600 });
3939
});
4040
});

‎packages/opentelemetry/src/utils/mapStatus.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function mapStatus(span: AbstractSpan): SpanStatus {
5656
if (status.message && isStatusErrorMessageValid(status.message)) {
5757
return { code: SPAN_STATUS_ERROR, message: status.message };
5858
} else {
59-
return { code: SPAN_STATUS_ERROR, message: 'internal_error' };
59+
return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
6060
}
6161
}
6262
}
@@ -72,7 +72,7 @@ export function mapStatus(span: AbstractSpan): SpanStatus {
7272
if (status?.code === SpanStatusCode.UNSET) {
7373
return { code: SPAN_STATUS_OK };
7474
} else {
75-
return { code: SPAN_STATUS_ERROR, message: 'internal_error' };
75+
return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
7676
}
7777
}
7878

@@ -96,7 +96,7 @@ function inferStatusFromAttributes(attributes: SpanAttributes): SpanStatus | und
9696
}
9797

9898
if (typeof grpcCodeAttribute === 'string') {
99-
return { code: SPAN_STATUS_ERROR, message: canonicalGrpcErrorCodesMap[grpcCodeAttribute] || 'internal_error' };
99+
return { code: SPAN_STATUS_ERROR, message: canonicalGrpcErrorCodesMap[grpcCodeAttribute] || 'unknown_error' };
100100
}
101101

102102
return undefined;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /