Skip to content

Conversation

@albertchae
Copy link
Contributor

Summary of the problem

Still having issues with puma metrics reporting in appsignal

Describe your changes

Follow instructions in https://docs.appsignal.com/ruby/integrations/puma.html#usage-with-preload_app

@albertchae albertchae requested a review from a team as a code owner November 25, 2025 12:22
Comment on lines +57 to +64
before_fork do
Appsignal::Probes.stop
end

# Add this on_worker_boot callback to start the minutely probes in the Puma worker processes
on_worker_boot do
Appsignal::Probes.start
end
Copy link

Choose a reason for hiding this comment

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

Bug: Incorrect AppSignal method names Appsignal::Probes.stop and Appsignal::Probes.start are used in Puma callbacks, leading to NoMethodError.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The code in config/puma.rb calls incorrect method names on the AppSignal gem: Appsignal::Probes.stop and Appsignal::Probes.start. When Puma executes these callbacks in non-development environments (where preload_app! is enabled), it will attempt to call methods that do not exist on the AppSignal gem. This will raise a NoMethodError or NameError. In the before_fork callback, the Puma master process will crash before it can fork workers. In the on_worker_boot callback, each worker process will crash before it can accept requests, causing the application to fail to start in production.

💡 Suggested Fix

Replace Appsignal::Probes.stop with Appsignal.stop_probes and Appsignal::Probes.start with Appsignal.start_probes in config/puma.rb.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: config/puma.rb#L57-L64

Potential issue: The code in `config/puma.rb` calls incorrect method names on the
AppSignal gem: `Appsignal::Probes.stop` and `Appsignal::Probes.start`. When Puma
executes these callbacks in non-development environments (where `preload_app!` is
enabled), it will attempt to call methods that do not exist on the AppSignal gem. This
will raise a `NoMethodError` or `NameError`. In the `before_fork` callback, the Puma
master process will crash before it can fork workers. In the `on_worker_boot` callback,
each worker process will crash before it can accept requests, causing the application to
fail to start in production.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 3466918

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.

2 participants