You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NoMethodError: undefined method `stats' for nil:NilClass (NoMethodError)
}.merge(@server.stats).merge(super)
^^^^^^
from puma/single.rb:20:in `stats'
from puma/launcher.rb:115:in `stats'
from puma/metrics/app.rb:26:in `retrieve_and_parse_stats!'
from puma/metrics/app.rb:17:in `call'
from puma/request.rb:100:in `block in handle_request'
from puma/thread_pool.rb:344:in `with_force_shutdown'
from puma/request.rb:99:in `handle_request'
from puma/server.rb:443:in `process_client'
from puma/server.rb:245:in `block in run'
from puma/thread_pool.rb:151:in `block in spawn_thread'
I am not exactly sure how this can be fixed, should Puma check if @server is nil before invoking merge:
class Single < Runner
# @!attribute [r] stats
def stats
{
started_at: utc_iso8601(@started_at)
}.merge(@server.stats).merge(super)
end
or should the metrics plugin check some status on @launcher before invoking stats.
As the method retrieve_and_parse_stats! is called every scrape (like every 30 seconds, depending on your prometheus configuration), I think adding a rescue or additional condition to the if/else clause should be sufficient?
Assuming the described NoMethodError applies to boottime only?
Hey, thanks for this very useful plugin.
We are experiencing a bug during deployments. It appears that metrics endpoint is served earlier than the rest of the application. This leads to:
Software versions: puma (6.3.1), puma-metrics (1.3.0)
Stacktrace:
I am not exactly sure how this can be fixed, should Puma check if
@server
isnil
before invokingmerge
:or should the metrics plugin check some status on
@launcher
before invokingstats
.Related code:
The text was updated successfully, but these errors were encountered: