Using Tags with Sidekiq Jobs

submited by
Style Pass
2021-06-24 07:00:11

A customer recently opened issue to point out a bug in Sidekiq’s tag filtering support and I realized: I haven’t told people that tags exist. Oops. Here is your notification. 😁

Sidekiq 6.0.1 added support for per-job tags. Tags are an Array of Strings within the job payload. Maybe you want to tag the sports related to a given job:

For example, assume we have a bunch of jobs which are associated with different sports. First we’ll create a bunch of jobs with random tags:

In Sidekiq Pro, the tags are clickable and will use Pro’s filtering support to show just jobs with that tag. Click a soccer ball and you’ll see all jobs tagged with it. The filter isn’t very smart; it looks for any substring match within the job’s JSON payload – make your tags unique or you can get false positives. That’s why I like to use emoji: they are unusual but short and easy to read.

Tags can make sets of jobs easier to find and manage within Redis. Have a creative use for tags? Have an idea to improve them? Open a issue and let me know.

Leave a Comment