diff --git a/app/controllers/idv_controller.rb b/app/controllers/idv_controller.rb index a4eb321d3d2..e31ef3450b2 100644 --- a/app/controllers/idv_controller.rb +++ b/app/controllers/idv_controller.rb @@ -12,6 +12,7 @@ def index elsif active_profile? && !strict_ial2_upgrade_required? redirect_to idv_activated_url elsif idv_attempter_throttled? + irs_attempts_api_tracker.idv_verification_rate_limited analytics.throttler_rate_limit_triggered( throttle_type: :idv_resolution, ) diff --git a/app/services/idv/steps/verify_base_step.rb b/app/services/idv/steps/verify_base_step.rb index b393cc1b704..8170620f34c 100644 --- a/app/services/idv/steps/verify_base_step.rb +++ b/app/services/idv/steps/verify_base_step.rb @@ -77,6 +77,7 @@ def throttle def idv_failure(result) throttle.increment! if result.extra.dig(:proofing_results, :exception).blank? if throttle.throttled? + @flow.irs_attempts_api_tracker.idv_verification_rate_limited @flow.analytics.throttler_rate_limit_triggered( throttle_type: :idv_resolution, step_name: self.class.name, diff --git a/app/services/irs_attempts_api/tracker_events.rb b/app/services/irs_attempts_api/tracker_events.rb index b2cf10f53cd..6ee79cca5c9 100644 --- a/app/services/irs_attempts_api/tracker_events.rb +++ b/app/services/irs_attempts_api/tracker_events.rb @@ -284,6 +284,13 @@ def idv_ssn_submitted(success:, ssn:) ) end + # Track when idv verification is rate limited during idv flow + def idv_verification_rate_limited + track_event( + :idv_verification_rate_limited, + ) + end + # @param [Boolean] success # @param [String] document_state # @param [String] document_number diff --git a/spec/controllers/idv_controller_spec.rb b/spec/controllers/idv_controller_spec.rb index 6529c857d5c..7713a2dc87e 100644 --- a/spec/controllers/idv_controller_spec.rb +++ b/spec/controllers/idv_controller_spec.rb @@ -23,6 +23,9 @@ end it 'redirects to failure page if number of attempts has been exceeded' do + stub_attempts_tracker + expect(@irs_attempts_api_tracker).to receive(:track_event). + with(:idv_verification_rate_limited) user = create(:user) profile = create( :profile, diff --git a/spec/features/idv/doc_auth/verify_step_spec.rb b/spec/features/idv/doc_auth/verify_step_spec.rb index 3c02da3fc28..222d14bc191 100644 --- a/spec/features/idv/doc_auth/verify_step_spec.rb +++ b/spec/features/idv/doc_auth/verify_step_spec.rb @@ -181,6 +181,7 @@ end it 'throttles resolution and continues when it expires' do + expect(fake_attempts_tracker).to receive(:idv_verification_rate_limited) sign_in_and_2fa_user complete_doc_auth_steps_before_ssn_step fill_out_ssn_form_with_ssn_that_fails_resolution