Skip to content

Commit 779dfe3

Browse files
authored
fix: Remove auto unknown_error transaction status (getsentry#2440)
* ref: Mark transaction as failed on error * ref: Remove transaction status * fix: Don't set status if UnknownError
1 parent a46f7ee commit 779dfe3

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

packages/apm/src/integrations/tracing.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,16 @@ export class Tracing implements Integration {
202202
return event;
203203
}
204204

205-
if (
206-
Tracing.options.maxTransactionDuration !== 0 &&
207-
Tracing._isEnabled() &&
208-
event.type === 'transaction' &&
209-
event.timestamp &&
210-
event.start_timestamp &&
211-
(event.timestamp - event.start_timestamp > Tracing.options.maxTransactionDuration ||
212-
event.timestamp - event.start_timestamp < 0)
213-
) {
214-
return null;
205+
if (Tracing._isEnabled()) {
206+
const isOutdatedTransaction =
207+
event.timestamp &&
208+
event.start_timestamp &&
209+
(event.timestamp - event.start_timestamp > Tracing.options.maxTransactionDuration ||
210+
event.timestamp - event.start_timestamp < 0);
211+
212+
if (Tracing.options.maxTransactionDuration !== 0 && event.type === 'transaction' && isOutdatedTransaction) {
213+
return null;
214+
}
215215
}
216216

217217
return event;

packages/apm/src/span.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ export class Span implements SpanInterface, SpanContext {
238238
*/
239239
public setHttpStatus(httpStatus: number): this {
240240
this.setTag('http.status_code', String(httpStatus));
241-
this.setStatus(SpanStatus.fromHttpCode(httpStatus));
241+
const spanStatus = SpanStatus.fromHttpCode(httpStatus);
242+
if (spanStatus !== SpanStatus.UnknownError) {
243+
this.setStatus(spanStatus);
244+
}
242245
return this;
243246
}
244247

packages/types/src/span.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export enum SpanStatus {
9191
/** The operation completed successfully. */
9292
Ok = 'ok',
9393
/** Deadline expired before operation could complete. */
94-
DealineExceeded = 'deadline_exceeded',
94+
DeadlineExceeded = 'deadline_exceeded',
9595
/** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */
9696
Unauthenticated = 'unauthenticated',
9797
/** 403 Forbidden */
@@ -164,7 +164,7 @@ export namespace SpanStatus {
164164
case 503:
165165
return SpanStatus.Unavailable;
166166
case 504:
167-
return SpanStatus.DealineExceeded;
167+
return SpanStatus.DeadlineExceeded;
168168
default:
169169
return SpanStatus.InternalError;
170170
}

0 commit comments

Comments
 (0)