Purple-Devs / health_check

Simple health check of Rails app for use with uptime checking sites like newrelic and pingdom
MIT License
476 stars 125 forks source link

Issue with custom check #122

Open jasonkarns opened 2 years ago

jasonkarns commented 2 years ago

I'm a bit confused on the custom check behavior.

Per the docs, I've added a custom check by name:

config.add_custom_check("vtiger_ws") do
  "yo"
end

but when I hit http://127.0.0.1:3000/health_check/vtiger_ws expecting to get a failure with "yo" (as the non-empty error message), instead I get:

health_check failed: invalid argument to health_test.
thewalkingtoast commented 2 years ago

This is also happening to me in a Rails 7 / Ruby 3 app. Using "custom" still works but runs all customs, not just the named custom check.

jmarchello commented 1 year ago

@jasonkarns where are you calling the snippet you provided above? Could you provide the entire contents of the file here (with sensitive data removed if need be).

jasonkarns commented 1 year ago

@jmarchello I'll see what I can put up. It seems that the issue was due to the underscore in the check's name. Changing it to hyphen fixed the issue.

@robfractal do you have any more details from your investigation?

robfractal commented 1 year ago

@jasonkarns The only other thing I noted was that none of the built-in health checks used underscores either. e.g. 'sidekiq-redis-if-present', 'resque-redis-if-present', 's3-if-present', 'elasticsearch-if-present'