Skip to content

Publish submission counts metrics to CloudWatch#2147

Open
theseanything wants to merge 5 commits into
mainfrom
theseanything/submission-number-metrics
Open

Publish submission counts metrics to CloudWatch#2147
theseanything wants to merge 5 commits into
mainfrom
theseanything/submission-number-metrics

Conversation

@theseanything

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/b3cNvzu5/3136-record-kpis-in-cloudwatch

This adds automated submission count metrics to CloudWatch so we can track platform usage over time without manual reporting.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot stopped reviewing on behalf of theseanything due to an error June 4, 2026 19:38
private

def submission_counts_by_form_id
Submission.where(mode: "form").group(:form_id).count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently I think the submission counts collected by Anne exclude submissions to test forms by our end to end tests and smoke tests. Ought we do the same here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's okay - submissions are grouped by form id, so we can filter them out after.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The end-to-end tests create a form, submit it and then delete it. I don't know if we'll easily have the form ids to exclude and including known form ids would be tricky too, i think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm I agree with what Tom says, it feels like it will be easier to filter out before sending to CloudWatch, we can use the same criteria Anne uses currently in Splunk:

form_name!=capybara* form_name!=*smoke* form_name!=s3*

Publish SubmissionCount metrics grouped by form for KPI reporting.
Add metrics:export_submission_counts for scheduled KPI publishing.
Replace the periodic database aggregation rake task with an
incrementing counter at submission creation time, and export metrics
via PeriodicMetricReader.
@theseanything theseanything force-pushed the theseanything/submission-number-metrics branch from 82471a3 to 70c1c91 Compare June 18, 2026 14:21
@github-actions

Copy link
Copy Markdown
Contributor

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2147.submit.review.forms.service.gov.uk/

It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants