@@ -192,9 +192,12 @@ def test_no_installation(self, mock_record, safe_urlopen):
192
192
assert_halt_metric (
193
193
mock_record = mock_record , error_msg = SentryAppWebhookHaltReason .MISSING_INSTALLATION
194
194
)
195
- # PREPARE_WEBHOOK (failure)
195
+ # APP_CREATE (success) -> PREPARE_WEBHOOK (failure)
196
196
assert_count_of_metric (
197
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 1
197
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 2
198
+ )
199
+ assert_count_of_metric (
200
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 1
198
201
)
199
202
assert_count_of_metric (
200
203
mock_record = mock_record , outcome = EventLifecycleOutcome .HALTED , outcome_count = 1
@@ -607,13 +610,13 @@ def test_does_not_process_sentry_apps_without_issue_webhooks(self, mock_record,
607
610
assert len (safe_urlopen .mock_calls ) == 0
608
611
assert_success_metric (mock_record )
609
612
610
- # GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success)
613
+ # APP_CREATE (success) -> GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success)
611
614
# Our SentryAppInstallation test fixture automatically runs GrantExchanger to get a valid token
612
615
assert_count_of_metric (
613
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 2
616
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 3
614
617
)
615
618
assert_count_of_metric (
616
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 2
619
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 3
617
620
)
618
621
619
622
@with_feature ("organizations:integrations-event-hooks" )
@@ -666,12 +669,13 @@ def test_error_created_sends_webhook(self, mock_record, safe_urlopen):
666
669
667
670
assert_success_metric (mock_record )
668
671
669
- # GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (success) -> SEND_WEBHOOK (success) -> SEND_WEBHOOK (success)
672
+ # APP_CREATE (success) -> GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) ->
673
+ # SEND_WEBHOOK (success) -> SEND_WEBHOOK (success) -> SEND_WEBHOOK (success)
670
674
assert_count_of_metric (
671
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 5
675
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 6
672
676
)
673
677
assert_count_of_metric (
674
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 5
678
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 6
675
679
)
676
680
677
681
@responses .activate
@@ -943,12 +947,13 @@ def test_record_lifecycle_error_from_pubished_apps(self, mock_record, safe_urlop
943
947
assert self .sentry_app_1 .webhook_url in call_urls
944
948
assert self .sentry_app_2 .webhook_url in call_urls
945
949
946
- # GRANT_EXCHANGER (success) x 2 -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (success) x2 -> SEND_WEBHOOK (success) x2 -> SEND_WEBHOOK (halt) x2
950
+ # APP_CREATE (success) x 2 -> GRANT_EXCHANGER (success) x 2 -> PREPARE_WEBHOOK (success)
951
+ # -> SEND_WEBHOOK (success) x2 -> SEND_WEBHOOK (success) x2 -> SEND_WEBHOOK (halt) x2
947
952
assert_count_of_metric (
948
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 9
953
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 11
949
954
)
950
955
assert_count_of_metric (
951
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 7
956
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 9
952
957
)
953
958
assert_count_of_metric (
954
959
mock_record = mock_record , outcome = EventLifecycleOutcome .HALTED , outcome_count = 2
@@ -1013,12 +1018,13 @@ def test_sends_webhooks_to_all_installs_success(self, mock_record, safe_urlopen)
1013
1018
assert self .sentry_app_2 .webhook_url in call_urls
1014
1019
1015
1020
assert_success_metric (mock_record )
1016
- # GRANT_EXCHANGER (success) x 2 -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (success) x 2 -> SEND_WEBHOOK (success) x2 -> SEND_WEBHOOK (success) x2
1021
+ # APP_CREATE (success) x 2 -> GRANT_EXCHANGER (success) x 2 -> PREPARE_WEBHOOK (success)
1022
+ # -> SEND_WEBHOOK (success) x 2 -> SEND_WEBHOOK (success) x2 -> SEND_WEBHOOK (success) x2
1017
1023
assert_count_of_metric (
1018
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 9
1024
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 11
1019
1025
)
1020
1026
assert_count_of_metric (
1021
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 9
1027
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 11
1022
1028
)
1023
1029
1024
1030
@patch ("sentry.integrations.utils.metrics.EventLifecycle.record_event" )
@@ -1068,12 +1074,12 @@ def test_sends_webhooks_with_send_webhook_sentry_failure(self, mock_record):
1068
1074
assert_failure_metric (
1069
1075
mock_record , SentryAppSentryError (SentryAppWebhookFailureReason .EVENT_NOT_IN_SERVCEHOOK )
1070
1076
)
1071
- # GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (success) x 1 -> SEND_WEBHOOK (failure)
1077
+ # APP_CREATE (success) -> GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (success) x 1 -> SEND_WEBHOOK (failure)
1072
1078
assert_count_of_metric (
1073
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 4
1079
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 5
1074
1080
)
1075
1081
assert_count_of_metric (
1076
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 3
1082
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 4
1077
1083
)
1078
1084
assert_count_of_metric (
1079
1085
mock_record = mock_record , outcome = EventLifecycleOutcome .FAILURE , outcome_count = 1
@@ -1334,12 +1340,12 @@ def test_does_not_send_if_no_service_hook_exists(self, mock_record, safe_urlopen
1334
1340
assert_failure_metric (
1335
1341
mock_record , SentryAppSentryError (SentryAppWebhookFailureReason .MISSING_SERVICEHOOK )
1336
1342
)
1337
- # GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> send_webhook (error)
1343
+ # APP_CREATE (success) -> GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> send_webhook (error)
1338
1344
assert_count_of_metric (
1339
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 3
1345
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 4
1340
1346
)
1341
1347
assert_count_of_metric (
1342
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 2
1348
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 3
1343
1349
)
1344
1350
assert_count_of_metric (
1345
1351
mock_record = mock_record , outcome = EventLifecycleOutcome .FAILURE , outcome_count = 1
@@ -1362,12 +1368,12 @@ def test_does_not_send_if_event_not_in_app_events(self, mock_record, safe_urlope
1362
1368
assert_failure_metric (
1363
1369
mock_record , SentryAppSentryError (SentryAppWebhookFailureReason .EVENT_NOT_IN_SERVCEHOOK )
1364
1370
)
1365
- # GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (failure)
1371
+ # APP_CREATE (success) -> GRANT_EXCHANGER (success) -> PREPARE_WEBHOOK (success) -> SEND_WEBHOOK (failure)
1366
1372
assert_count_of_metric (
1367
- mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 3
1373
+ mock_record = mock_record , outcome = EventLifecycleOutcome .STARTED , outcome_count = 4
1368
1374
)
1369
1375
assert_count_of_metric (
1370
- mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 2
1376
+ mock_record = mock_record , outcome = EventLifecycleOutcome .SUCCESS , outcome_count = 3
1371
1377
)
1372
1378
assert_count_of_metric (
1373
1379
mock_record = mock_record , outcome = EventLifecycleOutcome .FAILURE , outcome_count = 1
0 commit comments