Skip to content

Commit d380d32

Browse files
feat(outcomes): Add file type to 'too large' outcome. (#87078)
Fixes: getsentry/team-ingest#635 --------- Co-authored-by: Priscila Oliveira <[email protected]>
1 parent 0f4429f commit d380d32

File tree

2 files changed

+128
-3
lines changed

2 files changed

+128
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import {Outcome} from 'sentry/types/core';
2+
3+
import {ClientDiscardReason, getReasonGroupName} from './getReasonGroupName';
4+
5+
describe('getReasonGroupName', function () {
6+
it('handles legacy too_large reason', function () {
7+
expect(getReasonGroupName(Outcome.INVALID, 'too_large')).toBe('too_large');
8+
});
9+
10+
it('handles all new too_large reasons', function () {
11+
const testCases: Array<[string, string]> = [
12+
['too_large_unknown', 'too_large'],
13+
['too_large_event', 'too_large_event'],
14+
['too_large_transaction', 'too_large_transaction'],
15+
['too_large_security', 'too_large_security'],
16+
['too_large_attachment', 'too_large_attachment'],
17+
['too_large_form_data', 'too_large_form_data'],
18+
['too_large_raw_security', 'too_large_raw_security'],
19+
['too_large_nel', 'too_large_nel'],
20+
['too_large_unreal_report', 'too_large_unreal_report'],
21+
['too_large_user_report', 'too_large_user_report'],
22+
['too_large_session', 'too_large_session'],
23+
['too_large_sessions', 'too_large_sessions'],
24+
['too_large_statsd', 'too_large_statsd'],
25+
['too_large_metric_buckets', 'too_large_metric_buckets'],
26+
['too_large_client_report', 'too_large_client_report'],
27+
['too_large_profile', 'too_large_profile'],
28+
['too_large_replay_event', 'too_large_replay_event'],
29+
['too_large_replay_recording', 'too_large_replay_recording'],
30+
['too_large_replay_video', 'too_large_replay_video'],
31+
['too_large_check_in', 'too_large_check_in'],
32+
['too_large_otel_log', 'too_large_otel_log'],
33+
['too_large_log', 'too_large_log'],
34+
['too_large_span', 'too_large_span'],
35+
['too_large_otel_span', 'too_large_otel_span'],
36+
['too_large_otel_traces_data', 'too_large_otel_traces_data'],
37+
['too_large_user_report_v2', 'too_large_user_report_v2'],
38+
['too_large_profile_chunk', 'too_large_profile_chunk'],
39+
];
40+
41+
testCases.forEach(([input, expected]) => {
42+
expect(getReasonGroupName(Outcome.INVALID, input)).toBe(expected);
43+
});
44+
});
45+
46+
it('handles unknown too_large reasons', function () {
47+
expect(getReasonGroupName(Outcome.INVALID, 'too_large_future_type')).toBe('internal');
48+
});
49+
50+
it('handles other existing reason types', function () {
51+
expect(getReasonGroupName(Outcome.INVALID, 'duplicate')).toBe('duplicate');
52+
expect(getReasonGroupName(Outcome.INVALID, 'duplicate_item')).toBe('invalid_request');
53+
expect(getReasonGroupName(Outcome.INVALID, 'project_id')).toBe('project_missing');
54+
expect(getReasonGroupName(Outcome.INVALID, 'invalid_transaction')).toBe(
55+
'invalid_data'
56+
);
57+
58+
expect(getReasonGroupName(Outcome.RATE_LIMITED, 'key_quota')).toBe('DSN limit');
59+
expect(getReasonGroupName(Outcome.RATE_LIMITED, 'org_quota')).toBe('global limit');
60+
61+
expect(getReasonGroupName(Outcome.FILTERED, 'browser-extensions')).toBe(
62+
'Browser Extensions'
63+
);
64+
65+
expect(getReasonGroupName(Outcome.CLIENT_DISCARD, 'queue_overflow')).toBe(
66+
ClientDiscardReason.QUEUE_OVERFLOW
67+
);
68+
});
69+
});

static/app/views/organizationStats/getReasonGroupName.ts

+59-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,34 @@ enum DiscardReason {
2424
INVALID_REPLAY_VIDEO = 'invalid_replay_video',
2525
PAYLOAD = 'payload',
2626
INVALID_COMPRESSION = 'invalid_compression',
27-
TOO_LARGE = 'too_large',
27+
TOO_LARGE = 'too_large', // Left for backwards compatibility
28+
TOO_LARGE_UNKNOWN = 'too_large_unknown',
29+
TOO_LARGE_EVENT = 'too_large_event',
30+
TOO_LARGE_TRANSACTION = 'too_large_transaction',
31+
TOO_LARGE_SECURITY = 'too_large_security',
32+
TOO_LARGE_ATTACHMENT = 'too_large_attachment',
33+
TOO_LARGE_FORM_DATA = 'too_large_form_data',
34+
TOO_LARGE_RAW_SECURITY = 'too_large_raw_security',
35+
TOO_LARGE_NEL = 'too_large_nel',
36+
TOO_LARGE_UNREAL_REPORT = 'too_large_unreal_report',
37+
TOO_LARGE_USER_REPORT = 'too_large_user_report',
38+
TOO_LARGE_SESSION = 'too_large_session',
39+
TOO_LARGE_SESSIONS = 'too_large_sessions',
40+
TOO_LARGE_STATSD = 'too_large_statsd',
41+
TOO_LARGE_METRIC_BUCKETS = 'too_large_metric_buckets',
42+
TOO_LARGE_CLIENT_REPORT = 'too_large_client_report',
43+
TOO_LARGE_PROFILE = 'too_large_profile',
44+
TOO_LARGE_REPLAY_EVENT = 'too_large_replay_event',
45+
TOO_LARGE_REPLAY_RECORDING = 'too_large_replay_recording',
46+
TOO_LARGE_REPLAY_VIDEO = 'too_large_replay_video',
47+
TOO_LARGE_CHECK_IN = 'too_large_check_in',
48+
TOO_LARGE_OTEL_LOG = 'too_large_otel_log',
49+
TOO_LARGE_LOG = 'too_large_log',
50+
TOO_LARGE_SPAN = 'too_large_span',
51+
TOO_LARGE_OTEL_SPAN = 'too_large_otel_span',
52+
TOO_LARGE_OTEL_TRACES_DATA = 'too_large_otel_traces_data',
53+
TOO_LARGE_USER_REPORT_V2 = 'too_large_user_report_v2',
54+
TOO_LARGE_PROFILE_CHUNK = 'too_large_profile_chunk',
2855
MISSING_MINIDUMP_UPLOAD = 'missing_minidump_upload',
2956
INVALID_MINIDUMP = 'invalid_minidump',
3057
SECURITY_REPORT = 'security_report',
@@ -44,7 +71,7 @@ enum DiscardReason {
4471
}
4572

4673
// List of Client Discard Reason according to the Client Report's doc - https://develop.sentry.dev/sdk/client-reports/#envelope-item-payload
47-
enum ClientDiscardReason {
74+
export enum ClientDiscardReason {
4875
QUEUE_OVERFLOW = 'queue_overflow',
4976
CACHE_OVERFLOW = 'cache_overflow',
5077
RATELIMIT_BACKOFF = 'ratelimit_backoff',
@@ -91,7 +118,36 @@ const invalidReasonsGroup: Record<string, DiscardReason[]> = {
91118
DiscardReason.INVALID_REPLAY_VIDEO,
92119
],
93120
payload: [DiscardReason.PAYLOAD, DiscardReason.INVALID_COMPRESSION],
94-
too_large: [DiscardReason.TOO_LARGE],
121+
too_large: [
122+
DiscardReason.TOO_LARGE, // Left for backwards compatibility
123+
DiscardReason.TOO_LARGE_UNKNOWN,
124+
],
125+
too_large_event: [DiscardReason.TOO_LARGE_EVENT],
126+
too_large_transaction: [DiscardReason.TOO_LARGE_TRANSACTION],
127+
too_large_security: [DiscardReason.TOO_LARGE_SECURITY],
128+
too_large_attachment: [DiscardReason.TOO_LARGE_ATTACHMENT],
129+
too_large_form_data: [DiscardReason.TOO_LARGE_FORM_DATA],
130+
too_large_raw_security: [DiscardReason.TOO_LARGE_RAW_SECURITY],
131+
too_large_nel: [DiscardReason.TOO_LARGE_NEL],
132+
too_large_unreal_report: [DiscardReason.TOO_LARGE_UNREAL_REPORT],
133+
too_large_user_report: [DiscardReason.TOO_LARGE_USER_REPORT],
134+
too_large_session: [DiscardReason.TOO_LARGE_SESSION],
135+
too_large_sessions: [DiscardReason.TOO_LARGE_SESSIONS],
136+
too_large_statsd: [DiscardReason.TOO_LARGE_STATSD],
137+
too_large_metric_buckets: [DiscardReason.TOO_LARGE_METRIC_BUCKETS],
138+
too_large_client_report: [DiscardReason.TOO_LARGE_CLIENT_REPORT],
139+
too_large_profile: [DiscardReason.TOO_LARGE_PROFILE],
140+
too_large_replay_event: [DiscardReason.TOO_LARGE_REPLAY_EVENT],
141+
too_large_replay_recording: [DiscardReason.TOO_LARGE_REPLAY_RECORDING],
142+
too_large_replay_video: [DiscardReason.TOO_LARGE_REPLAY_VIDEO],
143+
too_large_check_in: [DiscardReason.TOO_LARGE_CHECK_IN],
144+
too_large_otel_log: [DiscardReason.TOO_LARGE_OTEL_LOG],
145+
too_large_log: [DiscardReason.TOO_LARGE_LOG],
146+
too_large_span: [DiscardReason.TOO_LARGE_SPAN],
147+
too_large_otel_span: [DiscardReason.TOO_LARGE_OTEL_SPAN],
148+
too_large_otel_traces_data: [DiscardReason.TOO_LARGE_OTEL_TRACES_DATA],
149+
too_large_user_report_v2: [DiscardReason.TOO_LARGE_USER_REPORT_V2],
150+
too_large_profile_chunk: [DiscardReason.TOO_LARGE_PROFILE_CHUNK],
95151
minidump: [DiscardReason.MISSING_MINIDUMP_UPLOAD, DiscardReason.INVALID_MINIDUMP],
96152
security_report: [DiscardReason.SECURITY_REPORT, DiscardReason.SECURITY_REPORT_TYPE],
97153
unreal: [DiscardReason.PROCESS_UNREAL],

0 commit comments

Comments
 (0)