Releases: rameerez/allgood
Releases · rameerez/allgood
Add a rate limiting option to only run some checks certain times per day or hour
I came across this use case: I want to test expensive APIs are healthy and returning valid data, think OpenAI / LLM APIs.
But each call is expensive (~cents, but it adds up if UptimeRobot is checking the /healthcheck endpoint every 5 minutes, or if someone is maliciously refreshing the page), so I added a mechanism to only test certain checks like these on a rate-limited way, currently only implementing "x times per day/hour"
Example:
# Run expensive checks a limited number of times in `allgood`
check "OpenAI is responding with a valid LLM message", run: "2 times per day" do
openai = OpenAI::Client.new
response = openai.chat(
parameters: { model: "gpt-3.5-turbo-16k",
messages: [{ role: "user", content: "Hello!"}],
}
)
make_sure response.present?
end
Environment-dependent and conditional checks
- Improved the
allgood
DSL by adding optional conditionals on when individual checks are run - Allow for environment-specific checks with
only
andexcept
options (check "Test Check", only: [:development, :test]
) - Allow for conditional checks with
if
andunless
options, which can be procs or any other condition (check "Test Check", if: -> { condition }
) - Added visual indication of skipped checks in the healthcheck page
- Improved developer experience by showing why checks were skipped (didn't meet conditions, environment-specific, etc.)
- New DSL changes are fully backward compatible with the previous version (new options are optional, and checks will run normally if they are not specified), so the new version won't break existing configurations
- Changed configuration loading to happen after Rails initialization so we fix the segfault that could occur when requiring gems in the
allgood.rb
configuration file before Rails was initialized
🎉 Initial release!
You define checks in config/allgood.rb
, mount the Allgood engine in routes.rb
, and you're good to go!