Add config options to control instrumentation - #1545
Merged
Conversation
The last few releases added enqueue instrumentation one library at a time, each with its own changeset. They now ship together in one minor release, so combine them into a single changeset that lists every library. No changelog entry is lost, it is just told as one story.
Add an instrument option for each background job framework and library that lacked one. Sidekiq, Shoryuken, Que, Resque, Delayed Job, Active Job, Excon and MongoDB can now each be turned off through instrument_<name>, matching the existing options for Faraday, http.rb, Net::HTTP, Redis and Sequel. Setting one to false makes the hook report its dependencies as absent, so the integration never installs. That turns off both the job or request instrumentation and the enqueue instrumentation for that framework. Add the enable_job_enqueue_instrumentation option. When it is false, job_enqueue_events_suppressed? reports true, which every enqueue integration already checks before recording its event. This reuses the existing enqueue suppression path, so one option turns the enqueue events off everywhere without touching how the jobs themselves are instrumented. The Active Job integration did not check that flag for its own event yet, so it now does, the same way the standalone adapters do.
The diagnose output lists every config option, so the diagnose test expectations have to include the new instrument options and the enable_job_enqueue_instrumentation option. Point the submodule at the diagnose_tests commit that adds them.
|
鉁旓笍 All good! |
There was a problem hiding this comment.
Pull request overview
This PR prepares a minor release by adding configuration switches to control background job and library instrumentation, including a global option to suppress enqueue event recording across all enqueue integrations, and by consolidating prior per-library enqueue changesets into unified release notes.
Changes:
- Add
enable_job_enqueue_instrumentationto globally suppress enqueue event recording without disabling job/request instrumentation. - Add per-integration
instrument_*config options (and env vars) to disable specific hooks entirely. - Consolidate multiple enqueue-related changesets into unified changeset entries.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/lib/appsignal/transaction_spec.rb | Adds coverage for job_enqueue_events_suppressed? default/disabled behavior. |
| spec/lib/appsignal/hooks/sidekiq_spec.rb | Verifies Sidekiq hook dependency gating via instrument_sidekiq. |
| spec/lib/appsignal/hooks/shoryuken_spec.rb | Verifies Shoryuken hook dependency gating via instrument_shoryuken. |
| spec/lib/appsignal/hooks/resque_spec.rb | Verifies Resque hook dependency gating via instrument_resque. |
| spec/lib/appsignal/hooks/que_spec.rb | Verifies Que hook dependency gating via instrument_que. |
| spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb | Verifies Mongo hook dependency gating via instrument_mongo. |
| spec/lib/appsignal/hooks/excon_spec.rb | Verifies Excon hook dependency gating via instrument_excon. |
| spec/lib/appsignal/hooks/delayed_job_spec.rb | Verifies Delayed Job hook dependency gating via instrument_delayed_job. |
| spec/lib/appsignal/hooks/activejob_spec.rb | Verifies Active Job hook dependency gating and enqueue suppression behavior. |
| spec/lib/appsignal/config_spec.rb | Extends config/env expectation fixtures for the new options. |
| sig/appsignal.rbs | Adds RBS definitions for the new config accessors. |
| sig/appsignal.rbi | Adds RBI (Sorbet) definitions for the new config accessors. |
| lib/appsignal/transaction.rb | Makes enqueue suppression reflect enable_job_enqueue_instrumentation. |
| lib/appsignal/hooks/sidekiq.rb | Gates Sidekiq hook installation on instrument_sidekiq. |
| lib/appsignal/hooks/shoryuken.rb | Gates Shoryuken hook installation on instrument_shoryuken. |
| lib/appsignal/hooks/resque.rb | Gates Resque hook installation on instrument_resque. |
| lib/appsignal/hooks/que.rb | Gates Que hook installation on instrument_que. |
| lib/appsignal/hooks/mongo_ruby_driver.rb | Gates Mongo hook installation on instrument_mongo. |
| lib/appsignal/hooks/excon.rb | Gates Excon hook installation on instrument_excon. |
| lib/appsignal/hooks/delayed_job.rb | Gates Delayed Job hook installation on instrument_delayed_job. |
| lib/appsignal/hooks/active_job.rb | Gates Active Job hook installation on instrument_active_job and respects enqueue suppression for its event. |
| lib/appsignal/config.rb | Adds defaults, env var mappings, and YARD docs for the new config options. |
| .changesets/title-sidekiq-delayed-enqueues-by-target.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/instrument-sidekiq-enqueues.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/instrument-resque-enqueues.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/instrument-que-enqueues.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/instrument-active-job-enqueues.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/emit-mongodb-body-as-json-string.md | Removes prior per-library Mongo-related changeset (now consolidated elsewhere). |
| .changesets/add-shoryuken-enqueue-instrumentation.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/add-delayed-job-enqueue-instrumentation.md | Removes prior per-library enqueue-related changeset (now consolidated). |
| .changesets/instrument-background-job-enqueues.md | Adds consolidated enqueue instrumentation changeset with global suppression option documented. |
| .changesets/add-instrument-config-options.md | Adds changeset documenting new per-integration instrument_* config options. |
Files not reviewed (1)
- sig/appsignal.rbi: File type not supported
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tombruijn
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepare a minor release before the OpenTelemetry collector PR (#1535) lands. It adds a config option for every background job framework and library that lacked one, adds an option to turn background job enqueue instrumentation off, and consolidates the per-library enqueue changesets into a single entry.
The diagnose test expectations live in a submodule. This branch bumps it to a commit from appsignal/diagnose_tests#155, which adds the new options. That companion PR needs to merge before the diagnose CI job here can pass.
Merge the enqueue changesets into one
The last few releases added enqueue instrumentation one library at a
time, each with its own changeset. They now ship together in one minor
release, so combine them into a single changeset that lists every
library. No changelog entry is lost, it is just told as one story.
Add config options to control instrumentation
Add an instrument option for each background job framework and library
that lacked one. Sidekiq, Shoryuken, Que, Resque, Delayed Job, Active
Job, Excon and MongoDB can now each be turned off through
instrument_, matching the existing options for Faraday, http.rb,
Net::HTTP, Redis and Sequel. Setting one to false makes the hook report
its dependencies as absent, so the integration never installs. That
turns off both the job or request instrumentation and the enqueue
instrumentation for that framework.
Add the enable_job_enqueue_instrumentation option. When it is false,
job_enqueue_events_suppressed? reports true, which every enqueue
integration already checks before recording its event. This reuses the
existing enqueue suppression path, so one option turns the enqueue
events off everywhere without touching how the jobs themselves are
instrumented. The Active Job integration did not check that flag for its
own event yet, so it now does, the same way the standalone adapters do.
Update diagnose tests for the new config options
The diagnose output lists every config option, so the diagnose test
expectations have to include the new instrument options and the
enable_job_enqueue_instrumentation option. Point the submodule at the
diagnose_tests commit that adds them.