@@ -165,7 +165,7 @@ def test_lookup_group_data_stacktrace_single_success(self):
165
165
event = self .event
166
166
hash = self .group_hashes [event .group .id ]
167
167
group_data , stacktrace_string = lookup_group_data_stacktrace_single (
168
- self .project , event .event_id , event .group_id , event .group .message , hash
168
+ self .project , event .event_id , event .group_id , event .group .message
169
169
)
170
170
expected_group_data = CreateGroupingRecordData (
171
171
group_id = event .group .id ,
@@ -200,7 +200,6 @@ def test_lookup_group_data_stacktrace_single_exceptions(
200
200
event .event_id ,
201
201
event .group_id ,
202
202
event .group .message ,
203
- self .group_hashes [event .group .id ],
204
203
)
205
204
mock_logger .exception .assert_called_with (
206
205
"tasks.backfill_seer_grouping_records.event_lookup_exception" ,
@@ -221,18 +220,16 @@ def test_lookup_group_data_stacktrace_single_not_stacktrace_grouping(self):
221
220
project_id = self .project .id ,
222
221
assert_no_errors = False ,
223
222
)
224
- hash = GroupHash .objects .get (group_id = event .group .id )
225
223
group_data , stacktrace_string = lookup_group_data_stacktrace_single (
226
- self .project , event .event_id , event .group_id , event .group .message , hash
224
+ self .project , event .event_id , event .group_id , event .group .message
227
225
)
228
226
assert (group_data , stacktrace_string ) == (None , "" )
229
227
230
228
def test_lookup_group_data_stacktrace_single_no_stacktrace (self ):
231
229
"""Test that no data is returned if the event has no stacktrace"""
232
230
event = self .store_event (data = {}, project_id = self .project .id , assert_no_errors = False )
233
- hash = GroupHash .objects .get (group_id = event .group .id )
234
231
group_data , stacktrace_string = lookup_group_data_stacktrace_single (
235
- self .project , event .event_id , event .group_id , event .group .message , hash
232
+ self .project , event .event_id , event .group_id , event .group .message
236
233
)
237
234
assert (group_data , stacktrace_string ) == (None , "" )
238
235
@@ -244,7 +241,7 @@ def test_lookup_group_data_stacktrace_bulk_success(self, mock_metrics):
244
241
bulk_event_ids ,
245
242
invalid_event_ids ,
246
243
bulk_group_data_stacktraces ,
247
- ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages , self . group_hashes )
244
+ ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages )
248
245
249
246
expected_event_ids = {event .event_id for event in events }
250
247
expected_group_data = [
@@ -287,7 +284,7 @@ def test_lookup_group_data_stacktrace_bulk_exceptions(
287
284
for exception in exceptions :
288
285
mock_get_multi .side_effect = exception
289
286
with pytest .raises (Exception ):
290
- lookup_group_data_stacktrace_bulk (self .project , rows , messages , self . group_hashes )
287
+ lookup_group_data_stacktrace_bulk (self .project , rows , messages )
291
288
mock_logger .exception .assert_called_with (
292
289
"tasks.backfill_seer_grouping_records.bulk_event_lookup_exception" ,
293
290
extra = {
@@ -323,7 +320,7 @@ def test_lookup_group_data_stacktrace_bulk_not_stacktrace_grouping(self):
323
320
bulk_event_ids ,
324
321
invalid_event_ids ,
325
322
bulk_group_data_stacktraces ,
326
- ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages , hashes )
323
+ ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages )
327
324
expected_group_data = [
328
325
CreateGroupingRecordData (
329
326
group_id = event .group .id ,
@@ -363,46 +360,7 @@ def test_lookup_group_data_stacktrace_bulk_no_stacktrace_exception(self):
363
360
bulk_event_ids ,
364
361
invalid_event_ids ,
365
362
bulk_group_data_stacktraces ,
366
- ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages , hashes )
367
- expected_group_data = [
368
- CreateGroupingRecordData (
369
- group_id = event .group .id ,
370
- hash = hashes [event .group .id ],
371
- project_id = self .project .id ,
372
- message = event .group .message ,
373
- )
374
- for event in events
375
- ]
376
- expected_stacktraces = [
377
- f'Error{ i } : error with value\n File "function_{ i } .py", function function_{ i } '
378
- for i in range (2 )
379
- ]
380
- assert bulk_event_ids == {event .event_id for event in events }
381
- assert invalid_event_ids == {event .event_id }
382
- assert bulk_group_data_stacktraces ["data" ] == expected_group_data
383
- assert bulk_group_data_stacktraces ["stacktrace_list" ] == expected_stacktraces
384
-
385
- def test_lookup_group_data_stacktrace_bulk_no_hash (self ):
386
- """
387
- Test that if a group does not have a hash (for whatever reason), its data is not included
388
- in the bulk lookup result
389
- """
390
- # Use 2 events
391
- rows , events , messages , hashes = self .bulk_rows [:2 ], self .bulk_events [:2 ], {}, {}
392
- group_ids = [row ["group_id" ] for row in rows ]
393
- for group_id in group_ids :
394
- messages .update ({group_id : self .bulk_messages [group_id ]})
395
- hashes .update ({group_id : self .group_hashes [group_id ]})
396
- # Create one event with no hash
397
- event = self .store_event (data = {}, project_id = self .project .id , assert_no_errors = False )
398
- rows .append ({"event_id" : event .event_id , "group_id" : event .group_id })
399
- messages .update ({event .group_id : event .group .message })
400
-
401
- (
402
- bulk_event_ids ,
403
- invalid_event_ids ,
404
- bulk_group_data_stacktraces ,
405
- ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages , hashes )
363
+ ) = lookup_group_data_stacktrace_bulk (self .project , rows , messages )
406
364
expected_group_data = [
407
365
CreateGroupingRecordData (
408
366
group_id = event .group .id ,
@@ -430,7 +388,7 @@ def test_lookup_group_data_stacktrace_bulk_with_fallback_success(self):
430
388
self .group_hashes ,
431
389
)
432
390
bulk_group_data_stacktraces = lookup_group_data_stacktrace_bulk_with_fallback (
433
- self .project , rows , messages , hashes
391
+ self .project , rows , messages
434
392
)
435
393
436
394
expected_group_data = [
@@ -480,7 +438,7 @@ def test_lookup_group_data_stacktrace_bulk_with_fallback_use_single_fallback(
480
438
481
439
rows , messages , hashes = self .bulk_rows , self .bulk_messages , self .group_hashes
482
440
bulk_group_data_stacktraces = lookup_group_data_stacktrace_bulk_with_fallback (
483
- self .project , rows , messages , hashes = hashes
441
+ self .project , rows , messages
484
442
)
485
443
486
444
events = self .bulk_events
@@ -500,72 +458,6 @@ def test_lookup_group_data_stacktrace_bulk_with_fallback_use_single_fallback(
500
458
assert bulk_group_data_stacktraces ["data" ] == expected_group_data
501
459
assert bulk_group_data_stacktraces ["stacktrace_list" ] == expected_stacktraces
502
460
503
- @patch ("sentry.tasks.backfill_seer_grouping_records.logger" )
504
- @patch ("sentry.tasks.backfill_seer_grouping_records.lookup_group_data_stacktrace_bulk" )
505
- def test_lookup_group_data_stacktrace_bulk_with_fallback_no_hash (
506
- self , mock_lookup_group_data_stacktrace_bulk , mock_logger
507
- ):
508
- """
509
- Test that if a group does not have a hash (for whatever reason), we do not attempt the
510
- fallback and we log it
511
- """
512
- # Purposely exclude one event from being included in the bulk lookup response, so that the fallback is used
513
- events_missing = self .bulk_events [:- 1 ]
514
- group_data , stacktrace_strings = [], []
515
- for event in events_missing :
516
- grouping_info = get_grouping_info (None , project = self .project , event = event )
517
- stacktrace_string = get_stacktrace_string (grouping_info )
518
- group_data .append (
519
- CreateGroupingRecordData (
520
- group_id = event .group .id ,
521
- hash = self .group_hashes [event .group .id ],
522
- project_id = self .project .id ,
523
- message = event .group .message ,
524
- )
525
- )
526
- stacktrace_strings .append (stacktrace_string )
527
- mock_lookup_group_data_stacktrace_bulk .return_value = (
528
- {event .event_id for event in events_missing },
529
- set (),
530
- GroupStacktraceData (data = group_data , stacktrace_list = stacktrace_strings ),
531
- )
532
-
533
- # Purposely remove the hash for the missing event
534
- hashes = copy .deepcopy (self .group_hashes )
535
- del hashes [self .bulk_events [- 1 ].group .id ]
536
-
537
- rows , messages = self .bulk_rows , self .bulk_messages
538
- bulk_group_data_stacktraces = lookup_group_data_stacktrace_bulk_with_fallback (
539
- self .project , rows , messages , hashes = hashes
540
- )
541
-
542
- events = self .bulk_events [:- 1 ]
543
- expected_group_data = [
544
- CreateGroupingRecordData (
545
- group_id = event .group .id ,
546
- hash = hashes [event .group .id ],
547
- project_id = self .project .id ,
548
- message = event .group .message ,
549
- )
550
- for event in events
551
- ]
552
- expected_stacktraces = [
553
- f'Error{ i } : error with value\n File "function_{ i } .py", function function_{ i } '
554
- for i in range (4 )
555
- ]
556
- assert bulk_group_data_stacktraces ["data" ] == expected_group_data
557
- assert bulk_group_data_stacktraces ["stacktrace_list" ] == expected_stacktraces
558
- assert bulk_group_data_stacktraces ["data" ] == expected_group_data
559
- assert bulk_group_data_stacktraces ["stacktrace_list" ] == expected_stacktraces
560
- mock_logger .exception .assert_called_with (
561
- "tasks.backfill_seer_grouping_records.no_group_hash" ,
562
- extra = {
563
- "organization_id" : self .project .organization .id ,
564
- "project_id" : self .project .id ,
565
- "group_id" : self .bulk_events [- 1 ].group_id ,
566
- },
567
- )
568
-
569
461
@patch ("sentry.tasks.backfill_seer_grouping_records.logger" )
570
462
def test_lookup_group_data_stacktrace_bulk_with_fallback_event_lookup_error (self , mock_logger ):
571
463
"""
@@ -581,7 +473,7 @@ def test_lookup_group_data_stacktrace_bulk_with_fallback_event_lookup_error(self
581
473
rows [- 1 ]["event_id" ] = 10000
582
474
583
475
bulk_group_data_stacktraces = lookup_group_data_stacktrace_bulk_with_fallback (
584
- self .project , rows , messages , hashes
476
+ self .project , rows , messages
585
477
)
586
478
587
479
events = self .bulk_events [:- 1 ]
0 commit comments