diff --git a/lib/form1010_ezr/service.rb b/lib/form1010_ezr/service.rb index 2f6b459aeb3..76ba1609d8b 100644 --- a/lib/form1010_ezr/service.rb +++ b/lib/form1010_ezr/service.rb @@ -47,6 +47,10 @@ def submit_sync(parsed_form) veteran_initials: veteran_initials(parsed_form) ) + if parsed_form['attachments'].present? + StatsD.increment("#{Form1010Ezr::Service::STATSD_KEY_PREFIX}.submission_with_attachment") + end + res rescue => e log_and_raise_error(e, parsed_form) diff --git a/spec/lib/form1010_ezr/service_spec.rb b/spec/lib/form1010_ezr/service_spec.rb index 0b36a41c372..3d1478111a4 100644 --- a/spec/lib/form1010_ezr/service_spec.rb +++ b/spec/lib/form1010_ezr/service_spec.rb @@ -447,7 +447,10 @@ def expect_personal_info_log(message) let(:form) { get_fixture('form1010_ezr/valid_form') } context 'with pdf attachments' do - it 'returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:32 GMT' do + it 'increments StatsD and returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:32 GMT' do + allow(StatsD).to receive(:increment) + expect(StatsD).to receive(:increment).with("api.1010ezr.submission_with_attachment") + VCR.use_cassette( 'form1010_ezr/authorized_submit_with_attachments', { match_requests_on: %i[method uri body], erb: true } @@ -467,7 +470,10 @@ def expect_personal_info_log(message) end context 'with a non-pdf attachment' do - it 'returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:34 GMT' do + it 'increments StatsD and returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:34 GMT' do + allow(StatsD).to receive(:increment) + expect(StatsD).to receive(:increment).with("api.1010ezr.submission_with_attachment") + VCR.use_cassette( 'form1010_ezr/authorized_submit_with_non_pdf_attachment', { match_requests_on: %i[method uri body], erb: true }