Skip to content

feat(crons): monitor slug underscore format with mashed default - #2750

Open
amkisko wants to merge 2 commits into
getsentry:masterfrom
amkisko:patch/cron-monitor-slug-formatting
Open

amkisko wants to merge 2 commits into
getsentry:masterfrom
amkisko:patch/cron-monitor-slug-formatting

Conversation

@amkisko

@amkisko amkisko commented Oct 16, 2025 •

Copy link
Copy Markdown

Summary

Aligns default cron monitor slug derivation with #3215, rebased onto current master (includes Sentry::Cron::Slug from #3200).

  • Class-name defaults can use Rails-style underscore word breaks (HappyWorkerWithCron → happy_worker_with_cron)
  • Long :underscore slugs keep a SHA256 prefix of the dropped part plus a readable tail (≤ 50 chars)
  • config.cron.monitor_slug_format selects :mashed (default) or :underscore for derived slugs only
  • Explicit sentry_monitor_check_ins(slug: ...) still wins; one format per process (no dual-emit)
  • Shared helpers live on Sentry::Cron::Slug; Slug.from for job keys is unchanged
  • No CHANGELOG.md edit (generated at release)
Sentry.init do |config|
  config.cron.monitor_slug_format = :mashed      # default during transition
  # config.cron.monitor_slug_format = :underscore
end

Test plan

  • sentry-ruby cron slug + monitor_check_ins specs
  • RuboCop on touched files
  • sentry-sidekiq sidekiq + sidekiq-scheduler specs (Redis)
  • sentry-rails good_job + good_job_cron + isolated good_job_cron specs (Postgres)
  • CI on this PR

fixes #3215
fixes #2594

cursor[bot]

This comment was marked as outdated.

@amkisko amkisko mentioned this pull request Oct 16, 2025
@sentry_monitor_slug ||= begin
slug = name.gsub("::", "-").downcase
slug[-MAX_SLUG_LENGTH..-1] || slug
slug = name.gsub("::", "-").gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data

This [regular expression](1) that depends on a [library input](2) may run slow on strings with many repetitions of 'A'.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated group ([A-Z]+) from unlimited match to max 1000 characters.

@amkisko

amkisko commented Dec 4, 2025

Copy link
Copy Markdown
Author

Latest mainstream merged

@amkisko

amkisko commented Nov 18, 2026

Copy link
Copy Markdown
Author

Tracking issue for this change (including slug format selection for transition): #3215

@solnic solnic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for helping out with Good Job. Please remove CHANGELOG.md change as we generate changelog entries automatically (and optionally refine them manually) during the release process.

@amkisko

amkisko commented Nov 18, 2026

Copy link
Copy Markdown
Author

Thanks for helping out with Good Job. Please remove CHANGELOG.md change as we generate changelog entries automatically (and optionally refine them manually) during the release process.

Hi! Thank you too! I will align this PR with issue i created today and get rid of CHANGELOG.md entries.

@amkisko
amkisko force-pushed the patch/cron-monitor-slug-formatting branch from 779b1da to 62bd057 Compare November 18, 2026 10:57
@amkisko
amkisko requested a review from a team as a code owner November 18, 2026 10:57
@amkisko amkisko changed the title feat(monitor_check_ins): improve cron monitor slug readability with better formatting and hashing feat(crons): monitor slug underscore format with legacy default Nov 18, 2026
@amkisko
amkisko force-pushed the patch/cron-monitor-slug-formatting branch from 62bd057 to f6e46ea Compare November 18, 2026 10:58
Rebase onto current master and align with getsentry#3215. Default class-name
slugs stay legacy; `:underscore` adds word breaks and hash truncation via
shared `Sentry::Cron::Slug` helpers. No CHANGELOG edit.
@amkisko
amkisko force-pushed the patch/cron-monitor-slug-formatting branch from f6e46ea to 934e30b Compare November 18, 2026 10:59
Name describes the mashed CamelCase shape, not transition status.
@amkisko amkisko changed the title feat(crons): monitor slug underscore format with legacy default feat(crons): monitor slug underscore format with mashed default Nov 18, 2026
@amkisko

amkisko commented Nov 18, 2026

Copy link
Copy Markdown
Author

@solnic PR is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crons: default monitor slugs from class names should use underscore word breaks Support good_job

3 participants