Skip to content

[POC] Use a default actor such as Request or correlation_id as global scope when feature flags cannot be scoped to actors

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

As a follow-up to #327117 (comment 551751108), this issue to explore whether this is feasible and implement a POC:

I wonder if we actually need to retain "percentage of time", this will always be error prone and inaccurate, see how it is implemented in Flipper.

But we can turn almost anything into an actor through FeatureGate:

module FeatureGate
  def flipper_id
    return if new_record?
    "#{self.class.name}:#{id}"
  end
end

Because we can use an arbitrary number or string ➡️ https://github.com/jnunemaker/flipper/blob/a91863d6c5b7c79ac80868b3e5359a93b1c9d481/lib/flipper/gates/percentage_of_actors.rb#L32 it should be fairly easy to make a request / correlation_id an actor too, to make it less error prone.

Edited by 🤖 GitLab Bot 🤖