Skip to content

Trace the queue worker, dropping polling noise - #2266

Open
whi-tw wants to merge 1 commit into
mainfrom
whi-tw/3269-trace-queue-worker
Open

whi-tw wants to merge 1 commit into
mainfrom
whi-tw/3269-trace-queue-worker

Conversation

@whi-tw

@whi-tw whi-tw commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/KnaPaYVl/3269-tracing-for-cron-jobs-queue-worker

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Has all relevant documentation been updated?

Reminders

If you've made changes to the deployer role (files in modules/deployer-access):

  • Remember to run make <environment> forms/account apply on the relevant environments (dev, staging and/or prod)
  • Check the #govuk-forms-deployment-notifications Slack channel to ensure the apply-forms-terraform-<environment> pipelines have run successfully

@whi-tw
whi-tw force-pushed the whi-tw/3269-trace-queue-worker branch from a8d3f5b to 8b4d98b Compare September 8, 2026 09:24
We previously disabled tracing for the queue worker because the
SolidQueue polling loops created a flood of low-value spans in X-Ray,
drowning out the traces we actually care about:
806192d Don't enable OpenTelemetry for background jobs

This re-enables tracing with a dedicated ADOT sidecar for the queue
worker task, configured to filter out the polling noise at the collector
level before it reaches X-Ray.

Key changes:
- Queue worker gets its own ADOT sidecar with a filter/drop_spans
  processor that drops SolidQueue poll spans (forms-runner-queue DB
  queries, ActiveRecord.transaction, SolidQueue::* internal spans)
- OTEL_SERVICE_NAME overridden to `forms-runner-queue-worker` so it
  appears as a distinct node in the X-Ray service map
- OTEL_TRACES_SAMPLER_ARG set to 1.0 — the queue worker has low
  traffic so full sampling is appropriate; noise control is handled
  by the collector filter rather than the SDK sampler
- A sha256 hash of the collector config is embedded as a Docker label
  on the sidecar container, so changes to filter expressions
  automatically trigger a new task definition revision and ECS
  redeployment on the next terraform apply
- The same dockerLabels hash pattern is applied to the shared
  ecs-service module so the main app also benefits

The corresponding forms-runner change switches ActiveJob span naming
to :job_class so traces are labelled with the job class name
(e.g. `SendSubmissionJob process`) rather than the queue name
(e.g. `submissions process`)
@whi-tw
whi-tw force-pushed the whi-tw/3269-trace-queue-worker branch from 8b4d98b to b0d9a11 Compare September 8, 2026 09:26
@whi-tw
whi-tw marked this pull request as ready for review September 8, 2026 09:29
@whi-tw
whi-tw requested a review from cadmiumcat September 8, 2026 09:29
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.

1 participant