Skip to content

Redact delayed_jobs handler column in query logs - #5513

Draft
kathap wants to merge 10 commits into
mainfrom
delayed-jobs-handler-log-adoption
Draft

kathap wants to merge 10 commits into
mainfrom
delayed-jobs-handler-log-adoption

Conversation

@kathap

@kathap kathap commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

The serialized handler column is verbose and clutters the statement log. Strip its value from logged delayed_jobs INSERT/UPDATE statements via a Sequel extension, enabled through DB.connect when query logging is on.

  • A short explanation of the proposed change:
    The serialized handler column is verbose and clutters the statement log. This change does two things:

    1. Strip the handler value from logged delayed_jobs INSERT/UPDATE statements via a Sequel logging extension, enabled through DB.connect when query logging is on.
    2. Add a concise structured log line per enqueued job. Because the handler value is no longer in the statement log, we actively collect the useful fields of each background job and write them to a dedicated enqueued background job log line.
  • An explanation of the use cases your change solves
    The handler column holds the full serialized job payload, which produces very long, noisy log lines that make the statement log hard to read and inflate log volume. Stripping the handler value from logged delayed_jobs statements cleans that up.
    However, the handler value also carried fields that are useful when debugging worker/job behaviour (job class, operation, resource guid, retry number, user, request id, etc.). To keep that information available without the verbose payload, a new hash_for_logs method collects only those fields from each job and the Enqueuer writes them as a single structured log line. Net result: the statement log is clean, and every created job remains traceable.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

kathap added 2 commits October 5, 2026 18:41
The serialized handler column is verbose and clutters the statement
log. Strip its value from logged delayed_jobs INSERT/UPDATE statements
via a Sequel extension, enabled through DB.connect when query logging
is on.
@kathap
kathap force-pushed the delayed-jobs-handler-log-adoption branch from 2e31a22 to c3eb168 Compare October 6, 2026 07:41
@kathap
kathap marked this pull request as draft October 7, 2026 11:16

This branch has not been deployed

No deployments
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