Repository navigation
Description
Summary
Default cron monitor slugs derived from Ruby class names should insert word breaks with underscores (Rails-style underscore), instead of lowercasing CamelCase into a single token. Long names should truncate in a stable, unique way.
For transition, support both formats via an explicit slug format selection (one active format per process). Do not dual-emit check-ins to both slugs.
Implementation PR: #2750
Motivation
Sentry::Cron::MonitorCheckIns.sentry_monitor_slug currently does:
name.gsub("::", "-").downcaseSo HappyWorkerWithCron becomes happyworkerwithcron. That is hard to read in the Sentry Crons UI and differs from how Ruby/Rails usually turn constant names into identifiers.
Blind right-truncation on the 50-character limit also drops the distinctive prefix of deep namespaces.
This matters for Sidekiq scheduler jobs and any host that relies on the default slug. After #3200, Good Job cron keys often already look like snake_case keys; class-derived slugs still need the word-break fix.
A hard cutover breaks existing monitors that keyed off the mashed default. Format selection lets hosts keep legacy slugs until they migrate, then switch once.
Specification
- Convert CamelCase / nested constants to a slug with underscore word breaks (same intent as ActiveSupport
underscore), keeping::->-(or an equivalent separator already used by the SDK). - Cap length at the existing monitor slug max (50).
- When truncation is required, keep uniqueness (hash of the dropped portion + readable tail), rather than only slicing the end.
- Explicit
sentry_monitor_check_ins(slug: ...)remains unchanged and always wins over format selection. - Add a slug format selection for default (derived) slugs only, for example under cron config:
:legacy(or:mashed) - currentgsub("::", "-").downcasebehavior:underscore- new word-break behavior
- Default for the new option: prefer
:legacyfor one release (or until the next major) so existing monitors keep working; document switching to:underscore. Alternatively default to:underscorewith a clear changelog + migration note; choose one in review. - One format active per process. Do not send check-ins for both legacy and underscore slugs for the same job (avoids double monitor volume; see also check-in volume concerns).
- Truncation/hashing rules apply to
:underscore.:legacykeeps today's truncation unless a separate change says otherwise.
Guide-level
| Class | :legacy |
:underscore |
|---|---|---|
HappyWorkerWithCron |
happyworkerwithcron |
happy_worker_with_cron |
Sentry.init do |config|
# keep existing mashed defaults during transition
config.cron.monitor_slug_format = :legacy
# after monitors are recreated or slug: is set explicitly
# config.cron.monitor_slug_format = :underscore
endHosts that need a fixed value keep setting slug: explicitly (format selection ignored for that job).
Drawbacks / alternatives
- Adopt with format selection: small config surface; hosts choose cutover time; one monitor slug per job.
- Dual-emit both slugs: rejected. Doubles check-in volume and splits success/failure across two monitors.
- Hard cutover only +
slug:escape hatch: workable but forces every default-slug host to act immediately.
Prior art
- Rails
ActiveSupport::Inflector#underscore - ActiveRecord long index name hashing
- SDK config toggles for optional behavior (patches, cron defaults)
- PR feat(crons): monitor slug underscore format with mashed default #2750 (open implementation; may need a follow-up commit for format selection)
- Related: RUBY-15, Support
good_job#2594
Unresolved questions
- Default for
monitor_slug_format::legacyfor a transition release, or:underscoreimmediately with changelog? - Exact option name and home:
config.cron.monitor_slug_formatvs something shorter? - Should
Sentry::Cron::Slug.fromandsentry_monitor_slugshare one helper after feat(jobs): support for good job cron check-ins #3200, or only change the mixin path in this issue's PR? - Is Sidekiq-only impact in current specs acceptable as the documented break surface when default becomes
:underscore?
References
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsWaiting for: Product Owner
Activity
linear-code commentedon Nov 18, 2026
RUBY-247
feat(crons): add monitor slug format selection with underscore option
feat(crons): add monitor slug format selection with underscore option
feat(crons): add monitor slug format selection with underscore option