18
18
)
19
19
from sentry .models .project import Project
20
20
from sentry .onboarding_tasks import try_mark_onboarding_complete
21
- from sentry .plugins .bases .issue import IssueTrackingPlugin
22
- from sentry .plugins .bases .issue2 import IssueTrackingPlugin2
23
21
from sentry .signals import (
24
22
alert_rule_created ,
25
23
cron_monitor_created ,
@@ -480,44 +478,6 @@ def record_release_received(project, event, **kwargs):
480
478
transaction_processed .connect (record_release_received , weak = False )
481
479
482
480
483
- def record_user_context_received (project , event , ** kwargs ):
484
- user_context = event .data .get ("user" )
485
- if not user_context :
486
- return
487
- # checking to see if only ip address is being sent (our js library does this automatically)
488
- # testing for this in test_no_user_tracking_for_ip_address_only
489
- # list(d.keys()) pattern is to make this python3 safe
490
- elif list (user_context .keys ()) != ["ip_address" ]:
491
- success = OrganizationOnboardingTask .objects .record (
492
- organization_id = project .organization_id ,
493
- task = OnboardingTask .USER_CONTEXT ,
494
- status = OnboardingTaskStatus .COMPLETE ,
495
- project_id = project .id ,
496
- )
497
- if success :
498
- organization = Organization .objects .get_from_cache (id = project .organization_id )
499
- try :
500
- owner : RpcUser = organization .get_default_owner ()
501
- except IndexError :
502
- logger .warning (
503
- "Cannot record user context received for organization (%s) due to missing owners" ,
504
- project .organization_id ,
505
- )
506
- return
507
-
508
- analytics .record (
509
- "first_user_context.sent" ,
510
- user_id = owner .id ,
511
- organization_id = project .organization_id ,
512
- project_id = project .id ,
513
- )
514
-
515
- try_mark_onboarding_complete (project .organization_id , owner )
516
-
517
-
518
- event_processed .connect (record_user_context_received , weak = False )
519
-
520
-
521
481
@first_event_with_minified_stack_trace_received .connect (weak = False )
522
482
def record_event_with_first_minified_stack_trace_for_project (project , event , ** kwargs ):
523
483
organization = Organization .objects .get_from_cache (id = project .organization_id )
@@ -553,9 +513,6 @@ def record_event_with_first_minified_stack_trace_for_project(project, event, **k
553
513
)
554
514
555
515
556
- transaction_processed .connect (record_user_context_received , weak = False )
557
-
558
-
559
516
@event_processed .connect (weak = False )
560
517
def record_sourcemaps_received (project , event , ** kwargs ):
561
518
if not has_sourcemap (event ):
@@ -626,23 +583,6 @@ def record_sourcemaps_received_for_project(project, event, **kwargs):
626
583
627
584
@plugin_enabled .connect (weak = False )
628
585
def record_plugin_enabled (plugin , project , user , ** kwargs ):
629
- if isinstance (plugin , IssueTrackingPlugin ) or isinstance (plugin , IssueTrackingPlugin2 ):
630
- task = OnboardingTask .ISSUE_TRACKER
631
- status = OnboardingTaskStatus .PENDING
632
- else :
633
- return
634
-
635
- success = OrganizationOnboardingTask .objects .record (
636
- organization_id = project .organization_id ,
637
- task = task ,
638
- status = status ,
639
- user_id = user .id if user else None ,
640
- project_id = project .id ,
641
- data = {"plugin" : plugin .slug },
642
- )
643
- if success :
644
- try_mark_onboarding_complete (project .organization_id , user )
645
-
646
586
analytics .record (
647
587
"plugin.enabled" ,
648
588
user_id = user .id if user else None ,
@@ -654,10 +594,11 @@ def record_plugin_enabled(plugin, project, user, **kwargs):
654
594
655
595
@alert_rule_created .connect (weak = False )
656
596
def record_alert_rule_created (user , project : Project , rule_type : str , ** kwargs ):
657
- task = OnboardingTask .METRIC_ALERT if rule_type == "metric" else OnboardingTask .ALERT_RULE
597
+ if rule_type == "metric" :
598
+ return
658
599
rows_affected , created = OrganizationOnboardingTask .objects .create_or_update (
659
600
organization_id = project .organization_id ,
660
- task = task ,
601
+ task = OnboardingTask . ALERT_RULE ,
661
602
values = {
662
603
"status" : OnboardingTaskStatus .COMPLETE ,
663
604
"user_id" : user .id if user else None ,
@@ -672,22 +613,6 @@ def record_alert_rule_created(user, project: Project, rule_type: str, **kwargs):
672
613
673
614
@issue_tracker_used .connect (weak = False )
674
615
def record_issue_tracker_used (plugin , project , user , ** kwargs ):
675
- rows_affected , created = OrganizationOnboardingTask .objects .create_or_update (
676
- organization_id = project .organization_id ,
677
- task = OnboardingTask .ISSUE_TRACKER ,
678
- status = OnboardingTaskStatus .PENDING ,
679
- values = {
680
- "status" : OnboardingTaskStatus .COMPLETE ,
681
- "user_id" : user .id ,
682
- "project_id" : project .id ,
683
- "date_completed" : django_timezone .now (),
684
- "data" : {"plugin" : plugin .slug },
685
- },
686
- )
687
-
688
- if rows_affected or created :
689
- try_mark_onboarding_complete (project .organization_id , user )
690
-
691
616
if user and user .is_authenticated :
692
617
user_id = default_user_id = user .id
693
618
else :
0 commit comments