Skip to content

Publish form count KPI metrics to CloudWatch#2821

Open
theseanything wants to merge 1 commit into
mainfrom
theseanything/publish-form-counts-to-cloudwatch
Open

Publish form count KPI metrics to CloudWatch#2821
theseanything wants to merge 1 commit into
mainfrom
theseanything/publish-form-counts-to-cloudwatch

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 form count metrics to CloudWatch so we can track how the platform is growing over time and measure the impact of our work. A new service publishes counts grouped by organisation and state (live, archived, draft), and a metrics:export_form_counts rake task will run on a scheduled cron job to publish those metrics on a regular basis. This lays the foundation for KPI reporting without manual updates.

@theseanything theseanything marked this pull request as ready for review June 4, 2026 07:58
@theseanything theseanything requested review from a team and Copilot June 4, 2026 07:59

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.

Pull request overview

This PR introduces automated KPI publishing for form counts to AWS CloudWatch, enabling ongoing platform growth tracking without manual reporting.

Changes:

  • Added Metrics::FormCountService to aggregate form counts by organisation and form state and publish them to CloudWatch.
  • Added a metrics:export_form_counts rake task intended for scheduled execution.
  • Added specs covering the service publishing behaviour and the rake task wiring.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
app/services/metrics/form_count_service.rb Implements aggregation + CloudWatch publishing for per-org/per-state form counts.
lib/tasks/metrics.rake Adds scheduled-entry rake task to trigger publishing.
spec/services/metrics/form_count_service_spec.rb Verifies CloudWatch payload structure and error capture/re-raise behaviour.
spec/lib/tasks/metrics.rake_spec.rb Ensures rake task invokes Metrics::FormCountService#publish_form_counts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/services/metrics/form_count_service.rb Outdated
@theseanything theseanything force-pushed the theseanything/publish-form-counts-to-cloudwatch branch 3 times, most recently from 00a4a7a to 12d129c Compare June 4, 2026 17:58
Comment thread app/services/metrics/form_count_service.rb
@theseanything theseanything force-pushed the theseanything/publish-form-counts-to-cloudwatch branch from 12d129c to fa34024 Compare June 8, 2026 07:54
lfdebrux
lfdebrux previously approved these changes Jun 8, 2026

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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Comment thread app/services/metrics/form_count_service.rb
Comment thread app/services/metrics/form_count_service.rb
Comment thread spec/services/metrics/form_count_service_spec.rb
Export form counts grouped by organisation and state through the
OpenTelemetry Metrics SDK and OTLP collector sidecar. Internal
organisations are excluded from metrics. Includes a rake task for
scheduled publishing.
@theseanything theseanything force-pushed the theseanything/publish-form-counts-to-cloudwatch branch from a4178df to bed24a3 Compare June 22, 2026 14:41
@github-actions

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2821.admin.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.

3 participants