Skip to content

Improve slug generation for crons #2138

Closed
@cleptric

Description

@cleptric

I have a question regarding the Ruby SDK. In the documentation, it states

# slug defaults to the job class name
sentry_monitor_check_ins slug: 'custom_slug'

Currently it appears that the slug parameter is always required, since Ruby class names can contain punctuation (::) and will have capital letters.

e.g.
SuperFancy::PrivateGroups::SpecialOrganizations::ScheduleOutreachWorker

In the code, I would suggest that they use self.class.name.parameterize as the default, which will downcase the class name and replace the double colons with a dash.

[1] pry(main)> e=SuperFancy::PrivateGroups::SpecialOrganizations::ScheduleOutreachWorker.new
=> #<SuperFancy::PrivateGroups::SpecialOrganizations::ScheduleOutreachWorker:0x00007f13c7a366f0>
[2] pry(main)> e.class.name.parameterize
=> "superfancy-specialgroups-specialorganizations-scheduleoutreachworker"
[3] pry(main)> e.class.name.parameterize.size
=> 68

This example demonstrates the other issue that we're running into, which is one of length. Since the Dashboard UI constrains the value to 50 characters (this not mentioned in the documentation), it appears the slug parameter will still have to be used.

Are these assumptions correct?

Originally posted by @nimylian in getsentry/sentry#42283 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions