Repository navigation
fix: treat ephemeral containers consistently - #276
Conversation
Skip reporting from release and one-off containers through the shared reporter so Rails and Rack entry points behave the same way. Co-authored-by: Cursor <cursoragent@cursor.com>
f85e1e7 to
812f41a
Compare
| config.after_initialize do | ||
| if in_rails_console_or_runner? | ||
| logger.debug "No reporting since we're in a Rails console or runner process" | ||
| elsif in_one_off_container? |
There was a problem hiding this comment.
No longer needed here since Reporter#start! has this logic. We're moving it there for parity with Node/Python libs and so this behavior is not Rails-specific.
| container.start_with?("run.") | ||
| # Heroku release phase and one-off dynos are named "release.1234" and "run.1234". | ||
| def ephemeral_instance? | ||
| container.downcase.start_with?("release.") || container.start_with?("run.") |
There was a problem hiding this comment.
We downcase the release but not run because that's possibly a user-entered value in the Procfile?
There was a problem hiding this comment.
Just inherited what we were doing previously, but there's not a good reason for it. I'll downcase both for consistency.
| [ | ||
| ["Heroku release", Platform::Heroku.new("release.1")], | ||
| ["Heroku", Platform::Heroku.new("run.1234")], | ||
| ["Scalingo", Platform::Scalingo.new("one-off-1234")] | ||
| ].each do |platform_name, platform| | ||
| it "does not run the reporter thread in a #{platform_name} ephemeral instance" do |
There was a problem hiding this comment.
previous comment
Minor suggestion to run a single test for "ephemeral instances" and then if we're testing multiple we loop inside. It's fine though to have individual/separated tests, but generally for single behavior-testing on a few variants, and even slightly perf-gain, I usually lean on that.
| [ | |
| ["Heroku release", Platform::Heroku.new("release.1")], | |
| ["Heroku", Platform::Heroku.new("run.1234")], | |
| ["Scalingo", Platform::Scalingo.new("one-off-1234")] | |
| ].each do |platform_name, platform| | |
| it "does not run the reporter thread in a #{platform_name} ephemeral instance" do | |
| it "does not run the reporter thread in an ephemeral instance" do | |
| [ | |
| ["Heroku release", Platform::Heroku.new("release.1")], | |
| ["Heroku", Platform::Heroku.new("run.1234")], | |
| ["Scalingo", Platform::Scalingo.new("one-off-1234")] | |
| ].each do |platform_name, platform| |
Update: it's a bit of a personal opinion and may be controversial, and I also see the node and python packages are doing a similar test, so it's totally cool to leave as-is for consistency across the board.
Normalize Heroku container names once before checking release and one-off prefixes. Co-authored-by: Cursor <cursoragent@cursor.com>
Use Ruby's multi-prefix start_with? form for normalized Heroku ephemeral container checks. Co-authored-by: Cursor <cursoragent@cursor.com>
🤖 I have created a release *beep* *boop* --- ## [1.13.4](v1.13.3...v1.13.4) (2026-11-03) ### Bug Fixes * detect Solid Queue queues from running workers ([#277](#277)) ([43d0f3d](43d0f3d)) * skip the reporter in one-off containers ([#273](#273)) ([cfcbe12](cfcbe12)) * treat ephemeral containers consistently ([#276](#276)) ([ce7dc28](ce7dc28)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Design decisions
The reporter owns the skip behavior because ephemeral containers should never report regardless of which framework entry point starts Judoscale. Platform subclasses own the naming rules because only Heroku and Scalingo expose these container conventions.
Note
Low Risk
Behavior change is limited to skipping metrics reporting on ephemeral containers (including new Heroku release phase); redundant-instance logic is untouched.
Overview
Ephemeral container handling is centralized in the shared
Reporter:start!returns early whenconfig.current_platform.ephemeral_instance?, so Rails and other entry points no longer duplicate that check (Rails railtie dropsin_one_off_container?).Platform naming is updated from
one_off?toephemeral_instance?. Heroku now treatsrelease.*dynos (in addition torun.*) as ephemeral, with case-normalized prefix matching. Scalingo still treatsone-off-*as ephemeral. Formation dynos/containers are unchanged.Tests cover the rename, release dynos, and reporter behavior for Heroku release, Heroku one-off, and Scalingo one-off.
Reviewed by Cursor Bugbot for commit c8399c7. Bugbot is set up for automated code reviews on this repo. Configure here.