Skip to content

Commit 50d4cae

Browse files
committed
Update protocol namings
1 parent 7e5a22f commit 50d4cae

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

packages/browser/src/transports/fetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class FetchTransport extends BaseTransport {
113113
*/
114114
private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {
115115
if (this._isRateLimited(sentryRequest.type)) {
116-
this.recordLostEvent(Outcome.RateLimit, sentryRequest.type);
116+
this.recordLostEvent(Outcome.RateLimitBackoff, sentryRequest.type);
117117

118118
return Promise.reject({
119119
event: originalPayload,
@@ -164,7 +164,7 @@ export class FetchTransport extends BaseTransport {
164164
)
165165
.then(undefined, reason => {
166166
if (reason instanceof SentryError) {
167-
this.recordLostEvent(Outcome.QueueSize, sentryRequest.type);
167+
this.recordLostEvent(Outcome.QueueOverflow, sentryRequest.type);
168168
} else {
169169
this.recordLostEvent(Outcome.NetworkError, sentryRequest.type);
170170
}

packages/browser/src/transports/xhr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class XHRTransport extends BaseTransport {
2626
*/
2727
private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {
2828
if (this._isRateLimited(sentryRequest.type)) {
29-
this.recordLostEvent(Outcome.RateLimit, sentryRequest.type);
29+
this.recordLostEvent(Outcome.RateLimitBackoff, sentryRequest.type);
3030

3131
return Promise.reject({
3232
event: originalPayload,
@@ -65,7 +65,7 @@ export class XHRTransport extends BaseTransport {
6565
)
6666
.then(undefined, reason => {
6767
if (reason instanceof SentryError) {
68-
this.recordLostEvent(Outcome.QueueSize, sentryRequest.type);
68+
this.recordLostEvent(Outcome.QueueOverflow, sentryRequest.type);
6969
} else {
7070
this.recordLostEvent(Outcome.NetworkError, sentryRequest.type);
7171
}

packages/browser/test/unit/transports/base.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('BaseTransport', () => {
4949
visibilityState = 'hidden';
5050
document.dispatchEvent(new Event('visibilitychange'));
5151

52-
const outcomes = [{ reason: 'before_send', category: 'error', quantity: 1 }];
52+
const outcomes = [{ reason: Outcome.BeforeSend, category: 'error', quantity: 1 }];
5353

5454
expect(sendBeaconSpy).toHaveBeenCalledWith(
5555
envelopeEndpoint,
@@ -75,16 +75,16 @@ describe('BaseTransport', () => {
7575
transport.recordLostEvent(Outcome.SampleRate, 'transaction');
7676
transport.recordLostEvent(Outcome.NetworkError, 'session');
7777
transport.recordLostEvent(Outcome.NetworkError, 'session');
78-
transport.recordLostEvent(Outcome.RateLimit, 'event');
78+
transport.recordLostEvent(Outcome.RateLimitBackoff, 'event');
7979

8080
visibilityState = 'hidden';
8181
document.dispatchEvent(new Event('visibilitychange'));
8282

8383
const outcomes = [
84-
{ reason: 'before_send', category: 'error', quantity: 2 },
85-
{ reason: 'sample_rate', category: 'transaction', quantity: 1 },
86-
{ reason: 'network_error', category: 'session', quantity: 2 },
87-
{ reason: 'rate_limit', category: 'error', quantity: 1 },
84+
{ reason: Outcome.BeforeSend, category: 'error', quantity: 2 },
85+
{ reason: Outcome.SampleRate, category: 'transaction', quantity: 1 },
86+
{ reason: Outcome.NetworkError, category: 'session', quantity: 2 },
87+
{ reason: Outcome.RateLimitBackoff, category: 'error', quantity: 1 },
8888
];
8989

9090
expect(sendBeaconSpy).toHaveBeenCalledWith(

packages/browser/test/unit/transports/fetch.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('FetchTransport', () => {
129129
try {
130130
await transport.sendEvent(transactionPayload);
131131
} catch (_) {
132-
expect(spy).toHaveBeenCalledWith(Outcome.QueueSize, 'transaction');
132+
expect(spy).toHaveBeenCalledWith(Outcome.QueueOverflow, 'transaction');
133133
}
134134
});
135135

@@ -490,13 +490,13 @@ describe('FetchTransport', () => {
490490
try {
491491
await transport.sendEvent(eventPayload);
492492
} catch (_) {
493-
expect(spy).toHaveBeenCalledWith(Outcome.RateLimit, 'event');
493+
expect(spy).toHaveBeenCalledWith(Outcome.RateLimitBackoff, 'event');
494494
}
495495

496496
try {
497497
await transport.sendEvent(transactionPayload);
498498
} catch (_) {
499-
expect(spy).toHaveBeenCalledWith(Outcome.RateLimit, 'transaction');
499+
expect(spy).toHaveBeenCalledWith(Outcome.RateLimitBackoff, 'transaction');
500500
}
501501
});
502502
});

packages/browser/test/unit/transports/xhr.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('XHRTransport', () => {
9191
try {
9292
await transport.sendEvent(transactionPayload);
9393
} catch (_) {
94-
expect(spy).toHaveBeenCalledWith(Outcome.QueueSize, 'transaction');
94+
expect(spy).toHaveBeenCalledWith(Outcome.QueueOverflow, 'transaction');
9595
}
9696
});
9797

@@ -416,13 +416,13 @@ describe('XHRTransport', () => {
416416
try {
417417
await transport.sendEvent(eventPayload);
418418
} catch (_) {
419-
expect(spy).toHaveBeenCalledWith(Outcome.RateLimit, 'event');
419+
expect(spy).toHaveBeenCalledWith(Outcome.RateLimitBackoff, 'event');
420420
}
421421

422422
try {
423423
await transport.sendEvent(transactionPayload);
424424
} catch (_) {
425-
expect(spy).toHaveBeenCalledWith(Outcome.RateLimit, 'transaction');
425+
expect(spy).toHaveBeenCalledWith(Outcome.RateLimitBackoff, 'transaction');
426426
}
427427
});
428428
});

packages/types/src/transport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export enum Outcome {
99
BeforeSend = 'before_send',
1010
EventProcessor = 'event_processor',
1111
NetworkError = 'network_error',
12-
QueueSize = 'queue_size',
13-
RateLimit = 'rate_limit',
12+
QueueOverflow = 'queue_overflow',
13+
RateLimitBackoff = 'ratelimit_backoff',
1414
SampleRate = 'sample_rate',
1515
}
1616

0 commit comments

Comments
 (0)