@@ -25,33 +25,26 @@ enum DiscardReason {
2525 PAYLOAD = 'payload' ,
2626 INVALID_COMPRESSION = 'invalid_compression' ,
2727 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' ,
28+ // All the too_large we want to communicate to the end-user
29+ TOO_LARGE_EVENT = 'too_large:event' ,
30+ TOO_LARGE_TRANSACTION = 'too_large:transaction' ,
31+ TOO_LARGE_ATTACHMENT = 'too_large:attachment' ,
32+ TOO_LARGE_FORM_DATA = 'too_large:form_data' ,
33+ TOO_LARGE_NEL = 'too_large:nel' ,
34+ TOO_LARGE_UNREAL_REPORT = 'too_large:unreal_report' ,
35+ TOO_LARGE_USER_REPORT = 'too_large:user_report' ,
36+ TOO_LARGE_USER_REPORT_V2 = 'too_large:user_report_v2' ,
37+ TOO_LARGE_SESSION = 'too_large:session' ,
38+ TOO_LARGE_SESSIONS = 'too_large:sessions' ,
39+ TOO_LARGE_REPLAY_EVENT = 'too_large:replay_event' ,
40+ TOO_LARGE_REPLAY_RECORDING = 'too_large:replay_recording' ,
41+ TOO_LARGE_REPLAY_VIDEO = 'too_large:replay_video' ,
42+ TOO_LARGE_OTEL_LOG = 'too_large:otel_log' ,
43+ TOO_LARGE_LOG = 'too_large:log' ,
44+ TOO_LARGE_SPAN = 'too_large:span' ,
45+ TOO_LARGE_OTEL_SPAN = 'too_large:otel_span' ,
46+ TOO_LARGE_PROFILE_CHUNK = 'too_large:profile_chunk' ,
47+ TOO_LARGE_PROFILE = 'too_large:profile' ,
5548 MISSING_MINIDUMP_UPLOAD = 'missing_minidump_upload' ,
5649 INVALID_MINIDUMP = 'invalid_minidump' ,
5750 SECURITY_REPORT = 'security_report' ,
@@ -118,36 +111,29 @@ const invalidReasonsGroup: Record<string, DiscardReason[]> = {
118111 DiscardReason . INVALID_REPLAY_VIDEO ,
119112 ] ,
120113 payload : [ DiscardReason . PAYLOAD , DiscardReason . INVALID_COMPRESSION ] ,
121- too_large : [
122- DiscardReason . TOO_LARGE , // Left for backwards compatibility
123- DiscardReason . TOO_LARGE_UNKNOWN ,
124- ] ,
114+ too_large_other : [ DiscardReason . TOO_LARGE ] ,
125115 too_large_event : [ DiscardReason . TOO_LARGE_EVENT ] ,
126116 too_large_transaction : [ DiscardReason . TOO_LARGE_TRANSACTION ] ,
127- too_large_security : [ DiscardReason . TOO_LARGE_SECURITY ] ,
128117 too_large_attachment : [ DiscardReason . TOO_LARGE_ATTACHMENT ] ,
129118 too_large_form_data : [ DiscardReason . TOO_LARGE_FORM_DATA ] ,
130- too_large_raw_security : [ DiscardReason . TOO_LARGE_RAW_SECURITY ] ,
131119 too_large_nel : [ DiscardReason . TOO_LARGE_NEL ] ,
132120 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 ] ,
121+ too_large_user_report : [
122+ DiscardReason . TOO_LARGE_USER_REPORT ,
123+ DiscardReason . TOO_LARGE_USER_REPORT_V2 ,
124+ ] ,
125+ too_large_session : [ DiscardReason . TOO_LARGE_SESSION , DiscardReason . TOO_LARGE_SESSIONS ] ,
126+ too_large_replay : [
127+ DiscardReason . TOO_LARGE_REPLAY_EVENT ,
128+ DiscardReason . TOO_LARGE_REPLAY_RECORDING ,
129+ DiscardReason . TOO_LARGE_REPLAY_VIDEO ,
130+ ] ,
131+ too_large_log : [ DiscardReason . TOO_LARGE_OTEL_LOG , DiscardReason . TOO_LARGE_LOG ] ,
132+ too_large_span : [ DiscardReason . TOO_LARGE_SPAN , DiscardReason . TOO_LARGE_OTEL_SPAN ] ,
133+ too_large_profile : [
134+ DiscardReason . TOO_LARGE_PROFILE_CHUNK ,
135+ DiscardReason . TOO_LARGE_PROFILE ,
136+ ] ,
151137 minidump : [ DiscardReason . MISSING_MINIDUMP_UPLOAD , DiscardReason . INVALID_MINIDUMP ] ,
152138 security_report : [ DiscardReason . SECURITY_REPORT , DiscardReason . SECURITY_REPORT_TYPE ] ,
153139 unreal : [ DiscardReason . PROCESS_UNREAL ] ,
@@ -160,12 +146,21 @@ const invalidReasonsGroup: Record<string, DiscardReason[]> = {
160146 sampling : [ DiscardReason . TRANSACTION_SAMPLED ] ,
161147} ;
162148
163- function getInvalidReasonGroupName ( reason : DiscardReason ) : string {
149+ function getInvalidReasonGroupName ( reason : string ) : string {
150+ // 1. Check if there is a direct match in the `invalidReasonsGroup`
151+ for ( const [ group , reasons ] of Object . entries ( invalidReasonsGroup ) ) {
152+ if ( reasons . includes ( reason as DiscardReason ) ) {
153+ return group ;
154+ }
155+ }
156+ // 2. If there is no direct match check if there is a match for the baseReason
157+ const baseReason = reason . split ( ':' ) [ 0 ] ;
164158 for ( const [ group , reasons ] of Object . entries ( invalidReasonsGroup ) ) {
165- if ( reasons . includes ( reason ) ) {
159+ if ( reasons . includes ( baseReason as DiscardReason ) ) {
166160 return group ;
167161 }
168162 }
163+ // 3. Else just return internal
169164 return 'internal' ;
170165}
171166
@@ -214,7 +209,7 @@ function getClientDiscardReasonGroupName(reason: ClientDiscardReason): string {
214209export function getReasonGroupName ( outcome : string | number , reason : string ) : string {
215210 switch ( outcome ) {
216211 case Outcome . INVALID :
217- return getInvalidReasonGroupName ( reason as DiscardReason ) ;
212+ return getInvalidReasonGroupName ( reason ) ;
218213 case Outcome . CARDINALITY_LIMITED :
219214 case Outcome . RATE_LIMITED :
220215 case Outcome . ABUSE :
0 commit comments