Repository navigation
feat(ruby): Add feature flag support - #3108
Conversation
|
@sl0thentr0py What is needed in order to merge this PR? |
Add Sentry.add_feature_flag and Scope#add_feature_flag to record boolean flag evaluations. Flags are kept in a 100-entry LRU buffer on the scope, attached to error events as contexts.flags.values (not transactions), and recorded on the active span as flag.evaluation.* data (max 10 per span).
393157e to
87922d8
Compare
|
thx @jespersandnielsen, I'll make some small changes and then merge it |
40704bc to
f2b0e98
Compare
f2b0e98 to
28220bc
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 28220bc. Configure here.
| def set_flag(name, result) | ||
| flag = "#{SPAN_FLAG_ATTRIBUTE_PREFIX}#{name}" | ||
| @flags[flag] = result if @flags.size < MAX_FLAGS | ||
| end |
There was a problem hiding this comment.
Span flags skip updates at cap
Medium Severity
Once a span already holds 10 feature flags, set_flag rejects every write, including a new result for a name that is already stored. The scope buffer still keeps the latest evaluation, so error events and the active span can disagree on the same flag.evaluation.* value after a re-evaluation.
Reviewed by Cursor Bugbot for commit 28220bc. Configure here.
There was a problem hiding this comment.
matches python behavior 🤷 agree that the logic is a bit whatever
Adds a changelog post for [sentry-ruby 7.3.0](https://github.com/getsentry/sentry-ruby/releases/tag/7.3.0), so Ruby users hear about the release's new features in the changelog and in Sentry's "What's New" panel (scoped to Ruby, Rails, and Rack orgs) and not only in the GitHub release notes. The post is framed around background work that fails quietly, and each section leads with the problem it solves: - **Know when a GoodJob cron job fails or never runs**: `config.enabled_patches << :good_job_cron` puts every GoodJob cron entry under Crons monitoring (getsentry/sentry-ruby#3200) - **See which feature flags were on when an error happened**: `Sentry.add_feature_flag` attaches flag evaluations to errors and spans (getsentry/sentry-ruby#3108) - **Spot jobs piling up in the queue**: ActiveJob, Sidekiq, and Resque jobs report queue wait time and payload size for the Queues dashboard (getsentry/sentry-ruby#3133) It closes with `Sentry.logger` block support (getsentry/sentry-ruby#3178), then links the full release notes. The new job extensions API (getsentry/sentry-ruby#3129) is left out because it only matters to people who maintain job backends. Nothing breaks. Open decisions: - The entry is `published: false`, so merging only creates it. To go live, set `published: true` before merge or publish it from the admin UI. - `author` is left unset because I couldn't confirm which email belongs to an existing changelog user. Add one if you want the post attributed. <!-- junior-request-attribution:start --> via @dingsdax. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3Ab5614f77a180622dc700158a --> -- [View Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3Ab5614f77a180622dc700158a) [[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Ab5614f77a180622dc700158a/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: johdax <114897+dingsdax@users.noreply.github.com>


Add Sentry.add_feature_flag and Scope#add_feature_flag to record boolean flag evaluations. Flags are kept in a 100-entry LRU buffer on the scope, attached to error events as contexts.flags.values (not transactions), and recorded on the active span as flag.evaluation.* data (max 10 per span).
Thanks for your Pull Request 🎉
Please keep these instructions in mind so we can review it more efficiently:
feat:,fix:,ref:,meta:)Other Notes
Description
Describe your changes: